fix(relinker): validate relative relocation table bounds #2222
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2222"
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 EshaanJaiswal on 2026-10-09T12:07:51Z.
What
Validate complete
DT_RELAandDT_JMPRELrelocation table ranges before parsing them.Malformed ELF metadata could declare a relocation table extending beyond its file-backed
PT_LOADsegment. The parser could then interpret bytes outside the segment as relocation entries.This change:
PT_LOAD.DT_RELAandDT_JMPREL.UINT64_MAXmetadata.Fixes #2221
Tested
Linux x86-64 (Ubuntu 26 LTS)
Tests use synthetic ELF byte arrays only. No PS5 hardware, controller, firmware, title, or game files are required.
Commands run:
Result:
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 repositoryImported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-09T12:07:57Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T12:09:22Z.
Review: COMMENTED
Review note:
collectRelativeEntriesnow skips only when both the address and size are zero. Previously it returned when either was zero. An ELF can have a relocation address tag with a zero relocation size; there are no entries to read, so requiring that address to map inside a PT_LOAD can reject an empty table. Please keep zero-sized tables as no-ops (while retaining the malformed nonzero-size checks) and add coverage for a nonzero table address with a zero size. I have not approved the PR; the current checks show Conventions only, so a Build result on this exact head is still needed as well.Imported from boykopovar/AnyPS5. Originally posted by EshaanJaiswal on 2026-10-09T12:12:22Z.
@MarcZX100, are you spying on me or something ? xD
How can someone review stuff so fast ?
Imported from boykopovar/AnyPS5. Originally posted by EshaanJaiswal on 2026-10-09T12:23:56Z.
Implemented the requested empty-table handling.
Zero-sized DT_RELA and DT_JMPREL tables now return early before address translation, so an unmapped address with size zero is treated as an empty table. Added regression coverage for this case.
Focused tests pass:
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T12:35:29Z.
Thanks, the follow-up addresses my empty-table concern: zero-sized tables now return before address translation, and the regression covers a nonzero unmapped address with zero size. The added bounds checks and malformed-size cases look consistent on the updated diff. The focused test results and Conventions are reported green; the upstream Build workflow is still not present on this head, so I am not submitting approval until the required Build jobs run.
Imported from boykopovar/AnyPS5. Originally posted by EshaanJaiswal on 2026-10-09T12:38:13Z.
@MarcZX100, Build Jobs won't be able to run unless I am a contributor or a maintainer approves this/my other PRs.
Imported from boykopovar/AnyPS5. Originally posted by rmz-24 on 2026-10-09T13:31:08Z.
Windows run: Windows 11 Pro 25H2 (10.0.26200.9457), RTX 5060 Ti (NVIDIA 617.42), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release,
-DANYPS5_ENABLE_SPIRV_TOOLS=ON, full build pluslibs.98b449f6cherry-picked onto currentmaind70b8998(applies cleanly).strict_nid_filterpasses.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T14:28:05Z.
I see the independent Windows report for this exact head cherry-picked onto
d70b8998: full build plus CTest 510/510, including the focused regression. That closes the Windows evidence gap. The remaining contribution-check gap is the full Linux Build and the relinker matrix on the current head; the PR currently reports only the focused Linux test. Since the author cannot dispatch the upstream workflow, an authorized collaborator would need to run it before this review can be finalized.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T20:50:22Z.
The PR has now received independent Windows validation for the current head (full build plus 510/510 CTest on a clean cherry-pick). I also verified the repository-required Linux/Windows full build and Linux/Windows/macOS relinker matrix workflow, but this checkout cannot dispatch it: GitHub returned 403 “Must have admin rights to Repository.” The only current check remains Conventions. I cannot submit an approval without the required project checks; a maintainer/collaborator with write access needs to run Actions > Build > Run workflow for PR #2222 on main.