Skip to content

fix(relinker): honor EIP-relative addresses in the control-flow graph - #10343

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
Filip722:submit/cfg-20261023
Oct 24, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
Filip722:submit/cfg-20261023

Conversation

@Filip722

Copy link
Copy Markdown
Contributor

What

The control-flow graph calculated EIP-relative memory operands as full 64-bit addresses. It could miss relocated call and jump targets or root a high-address function that a 32-bit LEA does not reference. Apply the decoded address size before looking up pointers or following LEA targets.

  • Truncate all four effective-address calculations for 32-bit addressing.
  • Cover relocated calls, jumps and both LEA-root paths in the existing CFG fixture.

Tested

Linux x86-64: each of the four new paths fails independently on unchanged main; the complete relinker build and suite pass after rebasing with the fix. Existing 64-bit transfers and roots remain covered. Windows/macOS execution not tested.

Rebased onto main a19e7f6fdc54; the historical native instruction/regression evidence above is retained. No performance tests were rerun. #8076 changes disjoint embedded-data table tests.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@github-actions

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 8076 core/relinker/relinker/tests/ControlFlowGraphTests.cpp

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head 2cd0e5e against current main. The four address-size-sensitive CFG paths are consistently truncated to 32 bits before relocation lookup or enqueue/address-root handling, then naturally zero-extended by the VirtualAddress conversion. This matches Intel's 64-bit-mode 32-bit effective-address rule. The regression fixture covers relocated 0x67 indirect CALL/JMP targets plus both LEA-derived root paths, and checks the resulting roots. The required relinker matrix passed on Ubuntu, Windows, macOS ARM64 and macOS x86_64; ASAN also passed. I did not run the local relinker suite in this session. The platform product jobs were skipped by repository policy.

@oneandonlydean oneandonlydean self-assigned this Oct 23, 2026
@oneandonlydean
oneandonlydean merged commit 933c0e4 into boykopovar:main Oct 24, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants