Peter Jung pushed to branch main at Arch Linux / Packaging / Packages / 
linux-tools


Commits:
00fbd9be by Peter Jung at 2024-12-19T23:50:34+01:00
upgpkg: 6.12-9, add fix for build id

There is currently a bug, which makes the build id not properly working.
This has been sent to stable, but since we commonly did not do minor pkgver 
bumps I do backport the patch.

Issues:
https://github.com/google/autofdo/issues/233

https://lore.kernel.org/all/z0arffw9xmh3m...@google.com/

- - - - -


3 changed files:

- .SRCINFO
- PKGBUILD
- + fix-buildid.patch


Changes:

=====================================
.SRCINFO
=====================================
@@ -1,6 +1,6 @@
 pkgbase = linux-tools
        pkgver = 6.12
-       pkgrel = 8
+       pkgrel = 9
        url = https://www.kernel.org
        arch = x86_64
        groups = linux-tools
@@ -46,6 +46,7 @@ pkgbase = linux-tools
        source = usbipd.service
        source = hv_kvp_daemon.service
        source = hv_vss_daemon.service
+       source = fix-buildid.patch
        validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886
        validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E
        sha256sums = 
267bab84f30e3ce4a88b6441aeee777b114fd58041b43cabfe50fdf0c0a97321
@@ -55,6 +56,7 @@ pkgbase = linux-tools
        sha256sums = 
2e187734d8aec58a3046d79883510d779aa93fb3ab20bd3132c1a607ebe5498f
        sha256sums = 
b1315cb77a35454e1af9172f821a52e2a0cb18561be05a340d21cf337b01ae61
        sha256sums = 
2d5e2f8d40b6f19bf2e1dead57ca105d72098fb0b418c09ff2e0cb91089710af
+       sha256sums = 
b0271b2757bb2cb05a1fd5560a732959cf28db82bb114aadcf7341b71ce127ea
 
 pkgname = bootconfig
        pkgdesc = Apply, delete or show boot config to initrd


=====================================
PKGBUILD
=====================================
@@ -15,7 +15,7 @@ pkgname=(
   'intel-speed-select'
 )
 pkgver=6.12
-pkgrel=8
+pkgrel=9
 license=('GPL-2.0-only')
 arch=('x86_64')
 url='https://www.kernel.org'
@@ -50,6 +50,7 @@ 
source=("git+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git#
         'usbipd.service'
         'hv_kvp_daemon.service'
         'hv_vss_daemon.service'
+        'fix-buildid.patch'
 )
 validpgpkeys=(
   'ABAF11C65A2970B130ABE3C479BE3E4300411886'  # Linus Torvalds
@@ -61,7 +62,8 @@ 
sha256sums=('267bab84f30e3ce4a88b6441aeee777b114fd58041b43cabfe50fdf0c0a97321'
             '42d2ec9f1d9cc255ee7945a27301478364ef482f5a6ddfc960189f03725ccec2'
             '2e187734d8aec58a3046d79883510d779aa93fb3ab20bd3132c1a607ebe5498f'
             'b1315cb77a35454e1af9172f821a52e2a0cb18561be05a340d21cf337b01ae61'
-            '2d5e2f8d40b6f19bf2e1dead57ca105d72098fb0b418c09ff2e0cb91089710af')
+            '2d5e2f8d40b6f19bf2e1dead57ca105d72098fb0b418c09ff2e0cb91089710af'
+            'b0271b2757bb2cb05a1fd5560a732959cf28db82bb114aadcf7341b71ce127ea')
 
 prepare() {
   cd linux


=====================================
fix-buildid.patch
=====================================
@@ -0,0 +1,46 @@
+From 62ebc7de4c306d99f39af847bee4a2aab05b0f93 Mon Sep 17 00:00:00 2001
+From: Namhyung Kim <namhy...@kernel.org>
+Date: Tue, 26 Nov 2024 19:13:31 -0800
+Subject: [PATCH] perf tools: Fix build-id event recording
+
+The build-id events written at the end of the record session are broken
+due to unexpected data.  The write_buildid() writes the fixed length
+event first and then variable length filename.
+
+But a recent change made it write more data in the padding area
+accidentally.  So readers of the event see zero-filled data for the
+next entry and treat it incorrectly.   This resulted in wrong kernel
+symbols because the kernel DSO loaded a random vmlinux image in the
+path as it didn't have a valid build-id.
+
+Fixes: ae39ba16554e ("perf inject: Fix build ID injection")
+Reported-by: Linus Torvalds <torva...@linux-foundation.org>
+Signed-off-by: Namhyung Kim <namhy...@kernel.org>
+---
+ tools/perf/util/build-id.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
+index 8982f68e7230cd64..e763e8d99a4367d7 100644
+--- a/tools/perf/util/build-id.c
++++ b/tools/perf/util/build-id.c
+@@ -277,7 +277,7 @@ static int write_buildid(const char *name, size_t 
name_len, struct build_id *bid
+       struct perf_record_header_build_id b;
+       size_t len;
+ 
+-      len = sizeof(b) + name_len + 1;
++      len = name_len + 1;
+       len = PERF_ALIGN(len, sizeof(u64));
+ 
+       memset(&b, 0, sizeof(b));
+@@ -286,7 +286,7 @@ static int write_buildid(const char *name, size_t 
name_len, struct build_id *bid
+       misc |= PERF_RECORD_MISC_BUILD_ID_SIZE;
+       b.pid = pid;
+       b.header.misc = misc;
+-      b.header.size = len;
++      b.header.size = sizeof(b) + len;
+ 
+       err = do_write(fd, &b, sizeof(b));
+       if (err < 0)
+-- 
+2.47.0.338.g60cca15819-goog



View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/linux-tools/-/commit/00fbd9be44872b571ab2bf8dd9d525a01d1e5b98

-- 
View it on GitLab: 
https://gitlab.archlinux.org/archlinux/packaging/packages/linux-tools/-/commit/00fbd9be44872b571ab2bf8dd9d525a01d1e5b98
You're receiving this email because of your account on gitlab.archlinux.org.


Reply via email to