fix(relinker): drop the input PT_PHDR and PT_INTERP from Linux output #2814
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2814"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by ctj01 on 2026-10-10T16:00:24Z.
What
Follow-up to #1559, raised in its review by @Dextroid17.
LinuxElfPatcherwrites its own PT_PHDR and PT_INTERP, butSegmentFilteralso kept the input's. Inputs from a standard toolchain carry both, for example ELFs linked with lld such as the ps5-payload-dev SDK homebrew in #2136.rtld.csets the main map's load bias from every PT_PHDR in turn (l_addr = phdr - p_vaddr), so the last one wins. That was the input's entry, whosep_vaddris where the table sat before relinking. The load bias came out wrong and the executable crashed at start.SegmentFilter::ShouldSkipnow drops the input's PT_PHDR and PT_INTERP, as it drops PT_DYNAMIC. The guest module writer already keeps only PT_LOAD, PT_TLS, PT_GNU_EH_FRAME and PT_GNU_STACK, so it is unchanged. Windows output does not useSegmentFilter.Tested
WSL2 Ubuntu 24.04 (kernel 5.15.167.4-microsoft-standard-WSL2, glibc 2.39, GCC 13.3), Linux build with
-DBUILD_TESTING=ON, onmainba2a0a31.Before the change, with synthetic lld-style inputs:
mainNew
linux_input_program_headerstest covers those four inputs plus both entries with exactly eight slots. For each output it checks:/lib64/ld-linux-x86-64.so.2and precedes the first PT_LOAD;int3.It fails without the
SegmentFilterchange (two PT_INTERP entries on the second case) and passes with it. Full suite: 699/699 withctest --test-dir build -j8.No title tested.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by ctj01 on 2026-10-10T16:00:26Z.
@Dextroid17 this is the
PT_PHDR/PT_INTERPfollow-up from #1559 you offered to run independently. The newlinux_input_program_headerstest holds the four input shapes from the description; thephdr-onlycase is the one that crashed at start through glibc's last-PT_PHDRload bias.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T16:00:35Z.
Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
Imported from boykopovar/AnyPS5. Originally posted by ctj01 on 2026-10-10T16:02:41Z.
Closed by the intake rule; the reproduction and this branch are tracked in #2816.
Pull request closed