Pin relocation-free mapping away from a reserved preferred base #114
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/115"
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 R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-21T16:25:55Z.
Change
This adds the CTest requested in #77, which settles the empty-directory case with measurements and leaves
pe_mapunchanged.tests/cpu/native_reloc_free_check.py(cpu_native_reloc_free) usescpu_import_original: no absolute addresses, base-relocation directory Size 0,IMAGE_FILE_RELOCS_STRIPPEDclear. I used it rather than thecpu_register_probefrom my issue comment because it exportscall_mix, so the call can be checked after loading; the register probe is the harness.Each case runs in its own child process, and:
0x180000000) forSizeOfImage, then checks withVirtualQuerythat the whole range is held by that reservation;LoadLibraryExWand maps it withpe_map;call_mixmatchesreference()on all 249input_pairs()(return value, trace words, RBX/RSI).The test covers:
DYNAMIC_BASEcleared;DYNAMIC_BASE-cleared copy at0x180000000. That makes the reserved Windows case the discriminating one, while ASLR would move the as-built copy anyway.pe_mapalways allocates away fromImageBase; for it, the test shows that an empty directory is accepted at another base and that the image runs there;RELOCS_STRIPPEDcontrol with the base reserved:LoadLibraryExWfails with error 487 (ERROR_INVALID_ADDRESS), andpe_maprejects the copy as "relocations stripped".The docs get a subsection at the end of the
pe_mapsection.Verification
At the head of this branch on
a46f1ff(Windows 11 build 26300, VS Build Tools 17.14, Python 3.14.10):The full suite gives 77 tests and 0 failures; only
bvh_wave64_hardwareandbvh_wave64_warpare skipped.As a one-off manual check (not in CI), I added the rejection proposed in #77 to
pe_map(if (delta && !relocs.Size)→ fail). The test then fails with "as built / pe_map: load failed with [4, 'empty relocation directory']".Evidence and follow-up
The fixture was already built from this repository, and the variants are byte patches written to a temporary directory. There is no game data. The exact bases vary between runs, so only base ≠ preferred is asserted. CI runs Python 3.12; I only ran 3.14 locally.
Refs #77
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T17:18:06Z.
The relocation-free comparison addresses #77. GitHub now reports conflicts with main. Please sync the branch, retain the newly registered CPU fixtures, and rerun cpu_native_reloc_free before re-review.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-21T17:26:10Z.
Synced on
86c927a. The only conflicts were inCMakeLists.txtanddocs/experiments.md, and both were resolved without dropping anything:cpu_native_mapkeeps its new--twoargument (cpu_two_imports), andcpu_native_reloc_freeis registered after it.pe_mapsection, before "Switch dispatch through jump tables".Rerun on Windows 11 build 26300:
All five
cpu_native_*tests pass, includingcpu_native_section, and the full suite gives 83 tests and 0 failures; only the two wave64 tests are skipped.AI-assisted.