Repository navigation
fix(relinker): stop code scans at the PLT for PS4 executables - #3142
Conversation
…DYNLIBDATA A PS4 executable (CUSA00900) keeps 37 MiB of read-only data in its executable segment after the code. The syscall scan and the call-site resolution decoded the whole segment linearly, reached a float table and failed with "Unsupported 0F 79 opcode without SSE4A prefix". In executables with a PT_SCE_DYNLIBDATA segment they now stop at the end of the PLT that follows the last function of the unwind table. The PLT is found by searching forward from that function for its first entry, which pushes the GOT entry at PLTGOT + 8 and jumps through PLTGOT + 16, since code without unwind entries can sit in between (680 bytes of start-up code in an OpenOrbis-built sample). When the executable has PLT relocations and no such entry follows, the relinker fails instead of guessing. Executables without the segment are scanned as before. (cherry picked from commit a21e8fe)
Dextroid17
left a comment
There was a problem hiding this comment.
The review of #3141 covers both of these — they are one idea applied twice, since both are about what PT_SCE_DYNLIBDATA means for a PS4 executable. The part belonging to this one: limiting the code scan by the .eh_frame function extents and finding the PLT by its actual bytes (ff 35 … ff 25, with the two displacements landing at GOT+8 and GOT+16, and the search bounded to size - 16 so the whole 16-byte header stays in range) is the honest version of that scan. Requiring a located PLT when relocations need one, rather than guessing at an extent, is the piece I would single out — a wrong scan boundary fails silently, and an error does not.
Also from that review, and true of both: the import_audit failure is an environment difference (it wants a source_commit stamp that already exists on main, and fails when git cannot resolve HEAD for the audited root), and the mutation and byte-identical conversion checks belong to the source author in #3093, which is where both bodies attribute them.
Written with AI assistance.
|
Windows run, since the PR has no Windows results yet: Windows 11, WinLibs GCC 15.2.0 r7, Release, merged onto
In the full AI-assisted (Claude Code); I ran this on my machine. |
|
Thanks for checking the Windows build and distinguishing the |
|
Checked on Linux: relinker build + ctest 95/95, including |
What
Limit syscall and import-call-site scans in PS4 executables with
PT_SCE_DYNLIBDATAto executable code through the PLT, rather than decoding the read-only data that follows the code. If relocations require a PLT and no PLT can be located, the relinker reports an error instead of guessing.Carried Get-fix's issue-linked commit from
fix/relinker-scan-code-extent; the original commit author is preserved. The limitation in--to-inteland theunused-filteranalyses remains documented in TechnicalDebt.Tested
Linux, GCC 12.2, Release:
dynamic_table_boundsandsce_code_extentpass on the combined validation branch. The full relinker-only suite was 104/105; the unrelatedimport_audittest fails because its test JSON has nosource_commitin this environment. The source author reports thesce_code_extentregression, mutation checks, and byte-identical PS5 conversion checks passing; see #3093.Windows 11, WinLibs GCC 15.2, Release, merged onto
maind31b57a4:sce_code_extentandstring_table_boundspass. The only full-suite failure not present on plainmainwasagc_driver_dcc_keys_first_write, which the reporter bisected to #3158.Checklist
main; no other open pull request implements this scan boundaryPT_SCE_DYNLIBDATA