fix(relinker): reject a relocation target whose range wraps the address space #2091
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2091"
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 treuenten on 2026-10-09T08:06:50Z.
What
CallSiteResolver::ResolveCallSitestakeslower_bound(address)andlower_bound(address + size). For a jump slot whoser_offsetis0xFFFFFFFFFFFFFFF8or higher,address + 8wraps, the upper iterator lands before the lower one, and the loop walks past the end of the map. On main the relinker dies with SIGSEGV (exit 139) in both Linux and--windowsmode instead of failing with an error. Under ASan:The resolver now throws
RelinkerException("Relocation target range exceeds the address space")when the range does not fit, with the samesize > max - begincheck asEhFrameReader.cpp:173andStrictNidFilter.cpp:26.0xFFFFFFFFFFFFFFF7still reaches the existing PT_LOAD containment check.test_jmprel_table_bounds.py: the fixture's jump slotr_offsetbecomes a parameter; targets0xFFFFFFFFFFFFFFF8,0xFFFFFFFFFFFFFFFCand0xFFFFFFFFFFFFFFFFmust exit 2 with the new message and write no output.No open pull request touches
CallSiteResolver.cppor this test.Tested
macOS arm64 (Apple M3), AppleClang 21, relinker-only build:
ctest34/34 in Release, and 34/34 with-fsanitize=address,undefined.python3 tools/check_conventions.py --base origin/mainpasses.Full CI on my fork (run 37943413968), using this repository's
build.ymlunchanged on this PR merged intomaind70b8998:jmprel_table_boundspasses on Linux and Windows.rmz-24 also ran the full Windows build with d5d6e577 (510/510).
Rebased onto
mainc963432don 2026-10-10 with no change to the diff (nowd1c14102). Thelinuxandwindowschecks on the old head failed because they built onmain6cc0503d, from before #2099 added SPIRV-Headers to the Vulkan test targets. Onc963432dboth full builds stop at the ctest registration check (agc_driver_recorder_testsis still inKNOWN_UNRUN). The same failure happens onmain's own push build, so it is not caused by this change. After the rebase, the relinker-only ctest passes 49/49 on macOS.Not run: any title.
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 (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by rmz-24 on 2026-10-09T11:58:39Z.
Windows run, since the description notes it wasn't tested there: Windows 11 Pro 25H2 (10.0.26200.9457), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, full build with
BUILD_TESTING=ON. d5d6e577 cherry-picked onto currentmaind70b8998(applies cleanly).jmprel_table_boundspasses.AI-assisted: yes