Merge ~r41k0u/ubuntu/+source/libtraceevent:fix-endian into ubuntu/+source/libtraceevent:ubuntu/devel

Proposed by Pragyansh Chaturvedi
Status: Merged
Merge reported by: Andreas Hasenack
Merged at revision: ac0f12e9ccf08150026ba8ab152a690c1980630c
Proposed branch: ~r41k0u/ubuntu/+source/libtraceevent:fix-endian
Merge into: ubuntu/+source/libtraceevent:ubuntu/devel
Diff against target: 73 lines (+42/-1)
4 files modified
debian/changelog (+8/-0)
debian/control (+2/-1)
debian/patches/0002-fix-file-endianness.patch (+31/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Ubuntu Sponsors Pending
git-ubuntu import Pending
Review via email: mp+477042@code.launchpad.net

Commit message

Set default file_bigendian in struct tep_handle

tep_alloc() creates a tep_handle object and sets the host_bigendian.
But it does not account for file_bigendian, which is set as TEP_LITTLE_ENDIAN
by default.
It is a safe assumption to set file_bigendian to the same value as
host_bigendian by default. If these are different, the user can set it using
event-parse-api
This fixes libtracefs on big-endian architectures, which depends on
libtraceevent. Without this fix, libtracefs would segfault on big-endian
architectures as host_bigendian would be set, but not file_bigendian.

To post a comment you must log in.
Revision history for this message
Adrien Nader (adrien) :
Revision history for this message
Pragyansh Chaturvedi (r41k0u) wrote :

Hi adrien
Thank you for reviewing! I have addressed your comments and rebased the branch

Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :

Thanks for the fix and also sending it upstream Pragyansh. I will add it to Debian today so it will just sync here in Ubuntu.

Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :

I have uploaded to Debian now. Thanks for working on this.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

This got fixed in debian, and synced[1] into plucky already. Closing MP.

1. https://launchpad.net/ubuntu/+source/libtraceevent/1:1.8.4-2

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 01bd474..fc57c5b 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+libtraceevent (1:1.8.4-1ubuntu1) plucky; urgency=medium
7+
8+ * Set default file_bigendian in struct tep_handle
9+ - d/p/0002-fix-file-endianness.patch: make file_bigendian the same
10+ as host_bignendian in tep_alloc() (LP: #2062118)
11+
12+ -- Pragyansh Chaturvedi <pragyansh.chaturvedi@canonical.com> Fri, 22 Nov 2024 13:32:27 +0530
13+
14 libtraceevent (1:1.8.4-1) unstable; urgency=medium
15
16 * New upstream version 1.8.4
17diff --git a/debian/control b/debian/control
18index 52a68c3..6f592a9 100644
19--- a/debian/control
20+++ b/debian/control
21@@ -1,6 +1,7 @@
22 Source: libtraceevent
23 Priority: optional
24-Maintainer: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
25+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
26+XSBC-Original-Maintainer: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
27 Build-Depends: debhelper-compat (= 13), pkgconf, asciidoc,
28 xmlto, source-highlight, libcunit1-dev
29 Standards-Version: 4.7.0
30diff --git a/debian/patches/0002-fix-file-endianness.patch b/debian/patches/0002-fix-file-endianness.patch
31new file mode 100644
32index 0000000..3471559
33--- /dev/null
34+++ b/debian/patches/0002-fix-file-endianness.patch
35@@ -0,0 +1,31 @@
36+Description: Set default file_bigendian in struct tep_handle
37+ tep_alloc() creates a tep_handle object and sets the host_bigendian.
38+ But it does not account for file_bigendian, which is set as TEP_LITTLE_ENDIAN
39+ by default.
40+ It is a safe assumption to set file_bigendian to the same value as
41+ host_bigendian by default. If these are different, the user can set it using
42+ event-parse-api
43+ This fixes libtracefs on big-endian architectures, which depends on
44+ libtraceevent. Without this fix, libtracefs would segfault on big-endian
45+ architectures as host_bigendian would be set, but not file_bigendian.
46+Author: Pragyansh Chaturvedi <pragyansh.chaturvedi@canonical.com>
47+Bug: https://bugzilla.kernel.org/show_bug.cgi?id=219543
48+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libtracefs/+bug/2062118
49+Forwarded: https://bugzilla.kernel.org/attachment.cgi?id=307303
50+Last-Update: 2024-11-22
51+---
52+--- a/src/event-parse.c 2024-11-20 01:08:35.806823782 +0530
53++++ b/src/event-parse.c 2024-11-22 13:13:50.775966911 +0530
54+@@ -8501,6 +8501,12 @@
55+ if (tep) {
56+ tep->ref_count = 1;
57+ tep->host_bigendian = tep_is_bigendian();
58++
59++ // We can make the following safe assumption
60++ // for the default case. Else it leaves the
61++ // file endianness as little endian and breaks
62++ // things on big endian architectures.
63++ tep->file_bigendian = tep->host_bigendian;
64+ }
65+
66+ return tep;
67diff --git a/debian/patches/series b/debian/patches/series
68index fb0d2e7..909d94f 100644
69--- a/debian/patches/series
70+++ b/debian/patches/series
71@@ -1 +1,2 @@
72 0001-utest-autopkgtest.patch
73+0002-fix-file-endianness.patch

Subscribers

People subscribed via source and target branches