Repository navigation
Fix PHDR coverage after repeated executable rewrites - #679
Merged
Merged
Conversation
rewriteSectionsExecutable() looked up the header LOAD by the offset just past the program header table. A previous rewrite sizes that LOAD with only a few bytes of slack after the table. When normalizeNoteSegments() then splits a multi-note PT_NOTE, the table grows past the LOAD's end, so the lookup finds nothing: the LOAD is neither reused nor extended and older LOADs are not trimmed. The PHDR segment is left outside any LOAD, and a relocated .dynamic can land in a read-only mapping, so ld.so crashes writing DT_DEBUG. The table always starts right after the ELF header, so look the LOAD up there instead. Fixes #675. Co-Authored-By: Claude Opus 5.5 <[email protected]>
domenkozar
enabled auto-merge
October 30, 2026 16:05
MIPS default linker scripts leave .interp as an orphan, so INSERT AFTER .interp fails before the test suite can run. Anchor the test notes before .dynsym instead, keeping them before .dynstr so the regression still exercises program header growth.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Repeated ET_EXEC rewrites can grow the program header table past the header LOAD after splitting NOTE segments. Looking up the LOAD by the table's start lets patchelf reuse and extend it, fixing invalid PHDR coverage on x86_64 and the subsequent AArch64 assertion failure.
Applies Jacob Michels' fix from 964670e with original authorship preserved. Adds an unreleased changelog entry and extends the regression test with a third rewrite. Prepared and validated with Codex assistance.
Validation:
Fixes #675.