fix(relinker): validate SysV hash chain bounds and 32-bit geometry overflow in symbol resolution #15903
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15903"
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 slopgobblercobbler on 2026-11-04T22:49:18Z.
What
Tested
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 ahmadmuj on 2026-11-06T06:29:43Z.
Review: COMMENTED
Checked head 9837a66e9391187e8faf9ab518d6b742ed1f36b0, PR base
6a37dfbed9, against mainfa134d9001. Relinker builds and control_flow_graph pass on both; head conventions pass.FindRelativeJumpTables can now loop forever on rejected displacements. In RelativeJumpTables.cpp:340-341, continue skips pos += info.Length. Bytes {0x75,0x80}, segment address 0, function range [0,2) reproduce this: unchanged head source times out after 2 seconds; main returns no tables immediately. The LEA guards at 423-424 also skip pos = next. Bytes {0x48,0x8d,0x05,0x80,0xff,0xff,0xff,0xcc,0xc3}, address 0, ranges [0,7) and [8,9) reproduce that separately.
Could both rejection paths advance or terminate the scan, with regression tests? Positive-overflow cases also time out; valid branch/LEA and exact nonempty-table controls pass. The gap scan completes because decoded[pos] prevents repetition. These are bounded synthetic scanner probes, not a title reproduction.
Imported from boykopovar/AnyPS5. Originally posted by descambiado on 2026-11-19T12:54:49Z.
Review: COMMENTED
Independent check of the
RelativeJumpTables.cppchanges, plus a read of the hash changes, at head bdd07bb (merge-based3074de). Ubuntu 24.04 (WSL2), GCC 13.3.Overflow. I built
relinker_corewith ASan and UBSan and ran a randomized driver over the analysis and conversion entry points (FindRelativeJumpTables,FindTrailingRelativeJumpTable,FindReplacedPltStubs,FindSceCodeEnd,SceUnwindRanges,AnalyzeStrictReachability,ReadRelativeTableTargets,Amd64OnlyConverterfor Intel and Rosetta,CodeInstructionCollector) with segment bases around 0, 2^63 and 2^64. 56,000 seeds on this head: no report and no timeout. The same driver on main hits signed overflow at lines 114, 335, 374 and 413 within 4,000 seeds. The two probes from ahmadmuj's review terminate here.Hash changes. I read the SysV and GNU parts of
StrictNidFilter.cpp. The geometry checks are bounded and the GNU symbol count follows the usual last bucket, then chain terminator walk. I found nothing wrong.Tests (UBSan, Linux). With the PR's tests kept and its sources reverted to the merge-base,
strict_nid_filterfails without the change, which is what you want.control_flow_graph,reloc_table_boundsandrelr_relocationspass either way, so on Linux they do not catch the signed overflow inRelativeJumpTables.cpp. A segment mapped at or above 2^63 with a negative branch displacement does (that is what #23003 tests).Not covered: Windows, and the
PltCompactorandRelinkerPipelinechanges beyond the driver.Two things for the author and the maintainers. The PR mixes several topics (hash bounds, 32-bit geometry, address arithmetic), which CONTRIBUTING asks to split. And #23003 touches the same four sites, so someone needs to say which goes first (
Depends on).AI-assisted: yes (Claude Code wrote the driver and ran the checks).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T13:14:21Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected changes add bounds checks for malformed ELF hash data and signed address calculations; I found no verified blocking defect, but could not run the reported checks.
What I ran
Reviewed head
bdd07bbaf45d2ceafbed5eef7c73fe619a146a35usingrepo_read.pyreader tools. No build, tests, or conventions check was run.Results
Findings
Blocking
None verified in the inspected changes.
Non-blocking
None.
Sources
Reviewed changed lines and targeted source context at the pinned head: CodeInstructionCollector.cpp, StrictNidFilter.cpp, RelativeJumpTables.cpp, RelinkerPipeline.cpp, and other changed files listed in the review manifest.
Not verified
The prepared diff and manifest cover all 14 changed files, and all 14 were inspected in the diff. Targeted source ranges were read from 11 changed files; full file contents were not read, and a source read for
ControlFlowGraphTests.cppcould not be completed. Build, test, conventions, and console behavior were not verified. The author reports Windows MSVC C++20 build and test success, plus a clean conventions check.To get this to a good state
Nothing is required. Optional: run the reported build, tests, and conventions check on this head before merge.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T11:12:41Z.
Review: COMMENTED
Reviewed — comments
The change adds bounds checks for malformed hash tables and address arithmetic, but the review bundle does not include file contents, so the full review and approval criteria could not be completed.
What I ran
f4d791315fdd3cdbfb901b99d16838bcaa53ed52.CodeInstructionCollector.cppandStrictNidFilter.cpp.Results
Findings
Blocking
None identified in the inspected code.
Non-blocking
core/relinker/relinker/src/analysis/CodeInstructionCollector.cpp:394).Not verified
The prepared bundle did not contain
review/files/full-text files, and the prompt-provided reader interface was unavailable as a callable command. I inspected only the diff and targeted repository ranges, not every changed file listed in the manifest. Consequently, the complete behavior, tests, and author-reported Windows build and test results are not verified. Excluded by review: full contents of all changed files beyond the inspected source ranges; no paths were marked excluded in the manifest.To get this to a good state
Nothing is required. Optional: run the stated Windows build and test suite against this exact head and include the results with the review.