fix(relinker): keep segment-relative transfers unresolved in CFG #13620
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/13620"
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 PolkadotDom on 2026-10-30T19:49:13Z.
What
An indirect
callorjmpthrough FS/GS-relative RIP/EIP memory was resolved using the relocation at the unbased effective address. The segment base is unknown to this analysis, so that relocation can belong to unrelated data. Following its value could add unrelated code to the graph or fail decoding bytes that the transfer never targets.Keep these transfers unresolved, as other indirect transfers are. Calls still fall through, jumps still end the block, and explicit roots remain reachable. Flat RIP/EIP transfers and ignored CS/DS/ES/SS overrides retain relocation resolution. FS/GS-prefixed LEA still discovers code addresses because LEA does not apply the segment base.
Addressing basis: Linux x86 architecture documentation, consistent with the existing call-site resolver's FS/GS exclusion. This does not infer an FS/GS base or implement runtime indirect-target discovery.
The overlap checker reports an uncomparable shared file with #10861 because that branch conflicts with current main. Manually compared its
ControlFlowGraph.cppdiff: it addsfollowPaddinghandling and changes the graph API/fall-through policy; it does not change either relocation lookup guarded here. No shared changed lines or dependency was found. Both this branch and the annotation fix are independent.Tested
Windows x64, Python 3.12.3, GCC 12.2.0, Ninja, Release relinker-only configuration with
BUILD_TESTING=ON, based on main3713032179.Segment-relative transfer followed a flat relocation slot; it passes with the fix. Final coverage is 28 transfer combinations (seven segment-prefix choices, RIP/EIP, call/jump), FS/GS unrelated undecodable targets and explicit-root controls, plus FS/GS-prefixed LEA controls.control_flow_graph,strict_nid_filter,relinker_conversion,call_site_index,call_registry, andguest_registry.select_tests_NonAsciiDirectoryTestsfails when dumping a build graph under a Unicode directory on this Windows toolchain. Reproduced separately using unchangedselect_tests.pyand its test from main; neither is touched here. The same failure was present in the preceding contribution round.git diff --checkpass. Merge preview onto the overlap checker's current-main snapshot is clean. Overlap warning manually reviewed as described above.Synthetic analysis/conversion fixtures only; no console binary, title execution, GPU validation, or local Linux/macOS run. No title is claimed unblocked.
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 blawesom on 2026-10-30T20:24:38Z.
Review: APPROVED
Verified
06340c048on Linux x86-64 (Ryzen 7 9800X3D, CachyOS kernel 6.2.10, GCC 16.2.1, Release, BUILD_TESTING=ON, Ninja; shared build dir, focused targets only).control_flow_graph_testson the PR head;control_flow_graphpasses 5/5 consecutive runs (no flakiness).relinker_conversion,relinker_game_patch,call_site_index,call_site_resolver,relinker_executables,guest_registry,call_registry,strict_nid_filter(9/9 includingcontrol_flow_graph).3713032179with only theControlFlowGraph.cppfix reverted (new tests kept) in a scratch build dir — it fails withSegment-relative transfer followed a flat relocation slot, and passes with the fix.relativeRelocations.TargetOfSlotwheninfo.SegmentPrefix != 0for RIP/EIP-relative indirectjmp/call(bothUnconditionalJumpandCallarms). This matches x86-64 semantics — FS/GS bases are unknown to this analysis, and CS/DS/ES/SS prefixes are null in 64-bit mode — and is consistent with the existing FS/GS exclusion pattern inWindowsTlsBuilder.cpp(SegmentPrefix == 0x65handling). No other call sites ofTargetOfSlotare affected.CheckCodeAddressesextends the FS/GS LEA address-discovery coverage. Segment-relative transfers staying unresolved (like other indirect transfers) matches the reported failure shape.Scope: relinker-only change, no GPU validation applicable (AGC protocol N/A). Not run: full test suite, Windows/console. PR body checklist is complete and consistent with the diff; the #10861 overlap claim (no shared changed lines) matches what I see in the diff.