Repository navigation
fix(relinker): validate relative relocation table bounds - #2222
oneandonlydean merged 2 commits into
Conversation
MarcZX10
left a comment
There was a problem hiding this comment.
Review note: collectRelativeEntries now 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.
|
@MarcZX100, are you spying on me or something ? xD |
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:
|
|
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. |
|
@MarcZX100, Build Jobs won't be able to run unless I am a contributor or a maintainer approves this/my other PRs. |
|
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,
AI-assisted: yes |
|
I see the independent Windows report for this exact head cherry-picked onto |
|
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. |
…location-bounds fix(relinker): validate relative relocation table bounds
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 repository