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 (sudip) 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 (sudip) 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
diff --git a/debian/changelog b/debian/changelog
index 01bd474..fc57c5b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
1libtraceevent (1:1.8.4-1ubuntu1) plucky; urgency=medium
2
3 * Set default file_bigendian in struct tep_handle
4 - d/p/0002-fix-file-endianness.patch: make file_bigendian the same
5 as host_bignendian in tep_alloc() (LP: #2062118)
6
7 -- Pragyansh Chaturvedi <pragyansh.chaturvedi@canonical.com> Fri, 22 Nov 2024 13:32:27 +0530
8
1libtraceevent (1:1.8.4-1) unstable; urgency=medium9libtraceevent (1:1.8.4-1) unstable; urgency=medium
210
3 * New upstream version 1.8.411 * New upstream version 1.8.4
diff --git a/debian/control b/debian/control
index 52a68c3..6f592a9 100644
--- a/debian/control
+++ b/debian/control
@@ -1,6 +1,7 @@
1Source: libtraceevent1Source: libtraceevent
2Priority: optional2Priority: optional
3Maintainer: Sudip Mukherjee <sudipm.mukherjee@gmail.com>3Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
4XSBC-Original-Maintainer: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
4Build-Depends: debhelper-compat (= 13), pkgconf, asciidoc,5Build-Depends: debhelper-compat (= 13), pkgconf, asciidoc,
5 xmlto, source-highlight, libcunit1-dev6 xmlto, source-highlight, libcunit1-dev
6Standards-Version: 4.7.07Standards-Version: 4.7.0
diff --git a/debian/patches/0002-fix-file-endianness.patch b/debian/patches/0002-fix-file-endianness.patch
7new file mode 1006448new file mode 100644
index 0000000..3471559
--- /dev/null
+++ b/debian/patches/0002-fix-file-endianness.patch
@@ -0,0 +1,31 @@
1Description: Set default file_bigendian in struct tep_handle
2 tep_alloc() creates a tep_handle object and sets the host_bigendian.
3 But it does not account for file_bigendian, which is set as TEP_LITTLE_ENDIAN
4 by default.
5 It is a safe assumption to set file_bigendian to the same value as
6 host_bigendian by default. If these are different, the user can set it using
7 event-parse-api
8 This fixes libtracefs on big-endian architectures, which depends on
9 libtraceevent. Without this fix, libtracefs would segfault on big-endian
10 architectures as host_bigendian would be set, but not file_bigendian.
11Author: Pragyansh Chaturvedi <pragyansh.chaturvedi@canonical.com>
12Bug: https://bugzilla.kernel.org/show_bug.cgi?id=219543
13Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libtracefs/+bug/2062118
14Forwarded: https://bugzilla.kernel.org/attachment.cgi?id=307303
15Last-Update: 2024-11-22
16---
17--- a/src/event-parse.c 2024-11-20 01:08:35.806823782 +0530
18+++ b/src/event-parse.c 2024-11-22 13:13:50.775966911 +0530
19@@ -8501,6 +8501,12 @@
20 if (tep) {
21 tep->ref_count = 1;
22 tep->host_bigendian = tep_is_bigendian();
23+
24+ // We can make the following safe assumption
25+ // for the default case. Else it leaves the
26+ // file endianness as little endian and breaks
27+ // things on big endian architectures.
28+ tep->file_bigendian = tep->host_bigendian;
29 }
30
31 return tep;
diff --git a/debian/patches/series b/debian/patches/series
index fb0d2e7..909d94f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
10001-utest-autopkgtest.patch10001-utest-autopkgtest.patch
20002-fix-file-endianness.patch

Subscribers

People subscribed via source and target branches