cpu: run a relocated global read/write through the three-way EXE chain #445

Merged
R0Y00 merged 3 commits from upstream-pr/451 into main 2026-11-22 04:26:56 +00:00
R0Y00 commented 2026-11-22 04:22:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-22T04:22:59Z.


Refs #317. Stacked on #416. The same source-built x64 EXE goes from entry to a fixed-frame caller, then to a bound no-unwind leaf that reads and writes the image's globals, then to a DLL import. A small host binds a live, nonpreferred mapping before calling the generated entry and checks the actual stored 64-bit word before release.

The negative control changes one writable word in the input EXE, keeping the AOT binary fixed. Both selectors change observable branches, DLL arguments, output bytes and exit codes. Native Windows and pe_map use the same source image in each comparison.

Local Windows x64 MSVC, Release:

cmake --build out/rip-release --target cpu_exe_image_lifted cpu_image_data_lifted cpu_bare_calls_lifted cpu_register_probe cpu_calls_lifted cpu_frame_lifted
ctest --test-dir out/rip-release --no-tests=error -R '^(cpu_native_exe_image_chain|cpu_aot_(image_data|stack_frames|direct_calls|bound_callees))$' --output-on-failure

5/5 passed. The four input/state combinations gave 0x60d, 0x57, 0x57, 0x60d across all three runners. Docs include the focused reproduction.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6538393627 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/451). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-22T04:22:59Z. --- Refs #317. Stacked on #416. The same source-built x64 EXE goes from entry to a fixed-frame caller, then to a bound no-unwind leaf that reads and writes the image's globals, then to a DLL import. A small host binds a live, nonpreferred mapping before calling the generated entry and checks the actual stored 64-bit word before release. The negative control changes one writable word in the input EXE, keeping the AOT binary fixed. Both selectors change observable branches, DLL arguments, output bytes and exit codes. Native Windows and pe_map use the same source image in each comparison. Local Windows x64 MSVC, Release: ```powershell cmake --build out/rip-release --target cpu_exe_image_lifted cpu_image_data_lifted cpu_bare_calls_lifted cpu_register_probe cpu_calls_lifted cpu_frame_lifted ctest --test-dir out/rip-release --no-tests=error -R '^(cpu_native_exe_image_chain|cpu_aot_(image_data|stack_frames|direct_calls|bound_callees))$' --output-on-failure ``` 5/5 passed. The four input/state combinations gave 0x60d, 0x57, 0x57, 0x60d across all three runners. Docs include the focused reproduction.
upstream-sync closed this pull request 2026-11-24 06:43:06 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!445
No description provided.