-
-
Notifications
You must be signed in to change notification settings - Fork 486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG FIX] false alarm for non overlapping sections #230
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested aesthetic improvements. Looks good!
Would be great to add a regression test. |
@domenkozar |
@rmNULL exactly! |
…e sections to segments. This also serves as a bug fix when a previously synced note segment overlaps with another section and creates a false alarm.
15c9d7e
to
6edec83
Compare
I think I just ran into this while packaging Energia (https://energia.nu) https://gist.github.com/aaronjanse/fa6d76c57c5e07c49dfe6094e4dd7de8 |
See NixOS/patchelf#230 Closes #65137. Signed-off-by: Michka Popoff <3406519+iMichka@users.noreply.github.com>
Thank you for merging, Eelco! 🌟 |
and thank you for the fix, @rmNULL! 🏆 |
Starting with version 0.12, patchelf sometimes returns an error complaining about overlapping sections: > unsupported overlap of SHT_NOTE and PT_NOTE This issue was reported for tsm-client: NixOS#106257 There is a patch available in this pull request: NixOS/patchelf#230 This patch fixes tsm-client, maybe other packages as well. This commit adds the patch to the nixpkgs patchelf build recipe. Note that the patch may also be downloaded directly here: https://github.com/NixOS/patchelf/pull/230.patch However, in contrast to common nixpkgs policy, the patch is not fetched with fetchpatch, but is copied directly into nixpkgs tree. This is necessary because patchelf is a dependency of fetchpatch. See also the note at the top of the patchelf build recipe in pkgs/development/tools/misc/patchelf/default.nix .
What these changes do
avoids recheck of marked note segments already synced with note sections,
This also serves as a bug fix when a previously synced note segment
overlaps with another section.
Steps to reproduce the bug
Description of bug
Running the above described commands fails with
why is this happening ?
patchelf/src/patchelf.cc
Lines 725 to 741 in 7aa6b90
In the above link, the previously updated program header will be compared against un updated section header(
orig_shdr
)verbose explanation
i'll paste the
PATCHELF_DEBUG=1
log here,if the log makes sense, please skip the writing.
orig_shdr =
.note.ABI-tag
is at0x1260
it finds a matching segment from
0x1260
to0x1280
and updates the phdr values to new shdr values
which is
0x1268
..0x1288
for the next replaced_section
orig_shdr =
.note.gnu.build-id
is at0x1280
it checks for overlap between
0x1280
..0x12a4
the previously updated phdr(
0x1268
..0x1288
)overlaps with this section.
phew 😥
Another point being,
it doesn't make sense to check the program once mapped to section
as the whole point of normalize note sections is to create 1 - 1 mapping
between section and segments.
Alternative ways to resolve the issue are welcome.
Thanks