fix(relinker): validate covered SCE RELRO file ranges #15345
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15345"
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 AasishDairelSahayaGrinspan on 2026-11-03T02:05:43Z.
What
Validate the ELF
p_filesz <= p_memszinvariant and file-backed range forPT_SCE_RELROheaders even when the RELRO range is covered by aPT_LOAD. Previously these checks only ran when an uncovered RELRO header was converted into a load segment, so malformed covered RELRO metadata was accepted. Add deterministic bounds regressions for both invalid cases.Tested
macOS 15, AppleClang 17, relinker-only Release build:
cmake -S . -B build-relinker -G Ninja -DCMAKE_BUILD_TYPE=Release -DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ONcmake --build build-relinker --target elf_reader_bounds_tests -j 4ctest --test-dir build-relinker -R "^elf_reader_bounds$" --output-on-failure— 1/1 passedpython3 tools/check_conventions.py --base origin/main— passedpr-overlapbot report: the only confirmed overlapping PR is #10518 (PT_LOAD/RELRO alignment power-of-two checks, line-adjacent in the same function but an independent check); #11628/#11661/#11689/#11698, #12009, #14121 and #15651 are file neighbors that do not implement covered SCE RELRO validation. No build dependency on any of them; Depends on stays none (see the re-check comment).git diff --check— passedNo title, GPU or full-runtime testing; this is an ELF parser-only change.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-03T02:36:53Z.
Review: COMMENTED
Reviewed — looks good
The source change and two new bounds regressions look correct, but approval is deferred until both pending macOS relinker jobs finish.
What I ran
e55a04e3741a083e02aac28a3f4a1bd353251196against base7feb37ee3e30e10139b483fb4df689d5b5b69ab8.Results
Precheck, CI and stack output
The test-quality helper could not launch:
Convention check output:
Stack checker stdout:
Hosted-check output:
Negative control
Not run. The two regressions need the exact-head C++ test binary; I did not build it.
Findings
Blocking
None identified in the reviewed diff. The validation now runs before the coverage decision for nonempty
PT_SCE_RELROentries, and the added fixtures exercise both invalid size and out-of-file cases when the RELRO range is covered byPT_LOAD.Non-blocking
None identified.
Sources
Not verified
To get this to a good state
No code change is requested. Let both macOS relinker jobs complete; if they pass on this exact head, I will approve it. If the head changes, I will rerun the applicable no-build checks and inspect the new diff.