fix(relinker): stop code scans at the PLT for PS4 executables #3142

Merged
MarcZX10 merged 1 commit from upstream-pr/3142 into main 2026-10-11 07:12:31 +00:00
MarcZX10 commented 2026-10-10 22:58:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T22:58:51Z.


What

Limit syscall and import-call-site scans in PS4 executables with PT_SCE_DYNLIBDATA to 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-intel and the unused-filter analyses remains documented in TechnicalDebt.

Tested

Linux, GCC 12.2, Release: dynamic_table_bounds and sce_code_extent pass on the combined validation branch. The full relinker-only suite was 104/105; the unrelated import_audit test fails because its test JSON has no source_commit in this environment. The source author reports the sce_code_extent regression, mutation checks, and byte-identical PS5 conversion checks passing; see #3093.

Windows 11, WinLibs GCC 15.2, Release, merged onto main d31b57a4: sce_code_extent and string_table_bounds pass. The only full-suite failure not present on plain main was agc_driver_dcc_keys_first_write, which the reporter bisected to #3158.

Checklist

  • Based on current main; no other open pull request implements this scan boundary
  • One topic per pull request
  • Conventions and diff checks pass; no code comments added
  • No silent stubs added
  • No investigation files or images added
  • No third-party code added
  • Generic behavior gated on PT_SCE_DYNLIBDATA
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4815041030 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3142). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-10T22:58:51Z. --- ### What Limit syscall and import-call-site scans in PS4 executables with `PT_SCE_DYNLIBDATA` to 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-intel` and the `unused-filter` analyses remains documented in TechnicalDebt. ### Tested Linux, GCC 12.2, Release: `dynamic_table_bounds` and `sce_code_extent` pass on the combined validation branch. The full relinker-only suite was 104/105; the unrelated `import_audit` test fails because its test JSON has no `source_commit` in this environment. The source author reports the `sce_code_extent` regression, mutation checks, and byte-identical PS5 conversion checks passing; see #3093. Windows 11, WinLibs GCC 15.2, Release, merged onto `main` `d31b57a4`: `sce_code_extent` and `string_table_bounds` pass. The only full-suite failure not present on plain `main` was `agc_driver_dcc_keys_first_write`, which the reporter bisected to #3158. ### Checklist - [x] Based on current `main`; no other open pull request implements this scan boundary - [x] One topic per pull request - [x] Conventions and diff checks pass; no code comments added - [x] No silent stubs added - [x] No investigation files or images added - [x] No third-party code added - [x] Generic behavior gated on `PT_SCE_DYNLIBDATA` - [x] Depends on: none - [x] AI-assisted: yes
Dextroid17 commented 2026-10-11 00:30:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-11T00:30:25Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5481341707 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3142#pullrequestreview-5481341707). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-11T00:30:25Z. **Review:** COMMENTED --- 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.
Silverash-i8 commented 2026-10-11 01:51:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Silverash-i8 on 2026-10-11T01:51:19Z.


Windows run, since the PR has no Windows results yet: Windows 11, WinLibs GCC 15.2.0 r7, Release, merged onto main d31b57a4 in one build with #3213, #3159, #3158, #3142, #3141 and #2977, on an RTX 5060 Laptop and the Arrow Lake iGPU (ANYPS5_GPU=Intel).

  • string_table_bounds and sce_code_extent pass on Windows (they don't use the GPU).

In the full ctest of that build, the only failure not also on plain main is agc_driver_dcc_keys_first_write, which I bisected to #3158 alone (reported there).

AI-assisted (Claude Code); I ran this on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6104356626 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3142#issuecomment-6104356626). Originally posted by [Silverash-i8](https://github.com/Silverash-i8) on 2026-10-11T01:51:19Z. --- Windows run, since the PR has no Windows results yet: Windows 11, WinLibs GCC 15.2.0 r7, Release, merged onto `main` d31b57a4 in one build with #3213, #3159, #3158, #3142, #3141 and #2977, on an RTX 5060 Laptop and the Arrow Lake iGPU (`ANYPS5_GPU=Intel`). - `string_table_bounds` and `sce_code_extent` pass on Windows (they don't use the GPU). In the full `ctest` of that build, the only failure not also on plain `main` is `agc_driver_dcc_keys_first_write`, which I bisected to #3158 alone (reported there). AI-assisted (Claude Code); I ran this on my machine.
MarcZX10 commented 2026-10-11 03:44:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T03:44:17Z.


Thanks for checking the Windows build and distinguishing the sce_code_extent result from the unrelated #3158 failure. I added the Windows focused-test result and that full-suite context to the PR's Tested section.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6105131644 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3142#issuecomment-6105131644). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T03:44:17Z. --- Thanks for checking the Windows build and distinguishing the `sce_code_extent` result from the unrelated #3158 failure. I added the Windows focused-test result and that full-suite context to the PR's Tested section.
adriadam10 commented 2026-10-11 07:12:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T07:12:27Z.


Checked on Linux: relinker build + ctest 95/95, including sce_code_extent; the test fails when the pipeline change is reverted. Merges cleanly with #3141, and the TechnicalDebt line sits in the right section. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106558176 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3142#issuecomment-6106558176). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T07:12:27Z. --- Checked on Linux: relinker build + ctest 95/95, including `sce_code_extent`; the test fails when the pipeline change is reverted. Merges cleanly with #3141, and the TechnicalDebt line sits in the right section. Merging.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!3142
No description provided.