[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230413022149.94781-1-joanbrugueram@gmail.com>
Date: Thu, 13 Apr 2023 02:21:49 +0000
From: Joan Bruguera Micó <joanbrugueram@...il.com>
To: jpoimboe@...nel.org
Cc: i.pear@...look.com, acme@...nel.org, alan.maguire@...cle.com,
alexandref75@...il.com, bpf@...r.kernel.org, dxu@...uu.xyz,
jforbes@...hat.com, linux-kernel@...r.kernel.org,
olsajiri@...il.com, peterz@...radead.org, ptalbert@...hat.com,
yhs@...com
Subject: Re: [PATCH] vmlinux.lds.h: Force-align ELF notes section to four bytes
I have done some tests with Arch Linux which is also affected by this issue:
Base scenario: Running Arch Linux updated as of 2023-04-13.
Building the linux-mainline 6.3rc6-1 from AUR
(https://aur.archlinux.org/packages/linux-mainline)
with CONFIG_X86_KERNEL_IBT changed to 'y'
Result: Build fails with the "btf__dedup failed!" error
Test 1: Update dwarves (=pahole package on Arch Linux) from the current version
(1:1.24+r29+g02d67c5-1) to the staging version (1:1.25-1).
Result: The build works correctly.
However, the notes section is still not parsed correctly, as confirmed
by `readelf -n` or adding a printf near the code on `cus__merging_cu`
(on `dwarf_loader.c`) pointed to by Tianyi.
A bisect shows the commit that fixes the build is
a9498899109d3be14f17abbc322a8f55a1067bee
"dwarf_loader: Fix for BTF id drift caused by adding unspecified types"
I don't know why though.
Test 2: Applying Josh's patch to force-align the ELF notes section to 4 bytes
(clarification: using the base pahole version again here)
Result: The build works correctly.
I can read the notes correctly using `readelf -n` as well,
and they are aligned to 4 bytes instead of 8.
Test 3: Similar to Josh's patch, but instead of force-aligning the sections,
I added `.note.gnu.property` to the `/DISCARD/` list in the line above.
Result: The build works correctly.
I can read the notes correctly using `readelf -n` as well
(of course, the GNU notes which made the alignment be 8 bytes are gone;
I don't know if this has any negative effect).
So, in summary, either upgrading dwarves/pahole from 1.24 to (not yet fully
released?) 1.25, or applying Josh's patch fixes the issue for me.
Despite the new dwarves/pahole version fixing the build, Josh's patch or
something else to fix the notes alignment is needed.
Powered by blists - more mailing lists