tests: keep exe_exit fixtures from ending the pe_map host (fixes #2457) #2457

Merged
tedin7 merged 1 commit from upstream-pr/2465 into main 2026-11-25 17:32:44 +00:00
tedin7 commented 2026-11-25 17:25:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T17:25:47Z.


Part of #1758

Fixes #2457

What this unblocks: main Windows checks go green again, so the merge queue moves.

Cause:

  • #1151 (280abb58d) makes pe_map_run_main write the mapped EXE base into PEB ImageBaseAddress, on purpose.
  • tests/cpu/exe_exit.h started_as_process() trusted only that field, so under pe_run_package a fixture saw itself as the real process.
  • It then called RtlExitUserProcess(13) and ended the Python runner before any JSON was printed.

Change: started_as_process() keeps the PEB ImageBaseAddress check and also requires that the first entry of PEB->Ldr->InLoadOrderModuleList has DllBase == &__ImageBase. Natively the process EXE is first in that list. Under pe_map the loader list is unchanged, so the first entry is the host. No new imports. tools/pe_map.cpp is untouched. Header comment updated.

Verification:

  • git diff --check: clean
  • x86_64-w64-mingw32-g++ -fsyntax-only -std=c++20 -fpermissive -Itests/cpu tests/cpu/package_ordinal_exe.cpp: rc 0
  • same for tests/cpu/startup_exe.cpp: rc 0 (only unrelated attribute warnings)
  • git grep -n "started_as_process\|exe_finish": only package_ordinal_exe.cpp and startup_exe.cpp call it
  • Win2025 dev + release: pending (Stage-2). ctest regex: cpu_native_package_ordinal_startup|cpu_native_startup|cpu_package_main_image|cpu_native_process_image|cpu_native_exe_tls_slot0

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6609963689 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2465). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T17:25:47Z. --- Part of #1758 Fixes #2457 What this unblocks: main Windows checks go green again, so the merge queue moves. Cause: - #1151 (280abb58d) makes `pe_map_run_main` write the mapped EXE base into PEB `ImageBaseAddress`, on purpose. - `tests/cpu/exe_exit.h` `started_as_process()` trusted only that field, so under `pe_run_package` a fixture saw itself as the real process. - It then called `RtlExitUserProcess(13)` and ended the Python runner before any JSON was printed. Change: `started_as_process()` keeps the PEB `ImageBaseAddress` check and also requires that the first entry of `PEB->Ldr->InLoadOrderModuleList` has `DllBase == &__ImageBase`. Natively the process EXE is first in that list. Under pe_map the loader list is unchanged, so the first entry is the host. No new imports. `tools/pe_map.cpp` is untouched. Header comment updated. Verification: - `git diff --check`: clean - `x86_64-w64-mingw32-g++ -fsyntax-only -std=c++20 -fpermissive -Itests/cpu tests/cpu/package_ordinal_exe.cpp`: rc 0 - same for `tests/cpu/startup_exe.cpp`: rc 0 (only unrelated attribute warnings) - `git grep -n "started_as_process\|exe_finish"`: only package_ordinal_exe.cpp and startup_exe.cpp call it - Win2025 dev + release: pending (Stage-2). ctest regex: `cpu_native_package_ordinal_startup|cpu_native_startup|cpu_package_main_image|cpu_native_process_image|cpu_native_exe_tls_slot0` AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-25 18:01:13 +00:00
tedin7 commented 2026-11-25 18:01:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T17:30:24Z.


Independent verification of ccad2835e

Win2025 WARP (5-slot pool, slot 1 C:\x2w), head ccad2835e8702db697da23f40553a1fa16883acb, fresh build of pe_map and the exe fixtures (tls_slot0, host, pause, enroll, process_image, startup/package_ordinal exes):

  • x2w_pipe.py win2025 2465 --force --targets pe_map,cpu_exe_tls_slot0,cpu_exe_tls_slot0_host,cpu_exe_tls_slot0_pause,cpu_exe_tls_slot0_enroll,cpu_exe_process_image,cpu_package_ordinal_exe,cpu_package_ordinal_exe_return,cpu_startup_exe,cpu_startup_exe_create,cpu_startup_exe_linger,cpu_startup_exe_linger_return,cpu_startup_exe_timeout --regex 'cpu_native_package_ordinal_startup|cpu_native_startup|cpu_package_main_image|cpu_native_process_image|cpu_native_exe_tls_slot0'
  • dev: 7/7 passed
  • release: 7/7 passed

An earlier run of the same regex had 4 failures (tls_slot0, tls_slot0_enroll, process_image, package_main_image). The cause was a target list that left out pe_map and the fixtures, so old binaries ran. With them built, all pass.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7169600451 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2465#issuecomment-7169600451). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T17:30:24Z. --- Independent verification of ccad2835e Win2025 WARP (5-slot pool, slot 1 `C:\x2w`), head `ccad2835e8702db697da23f40553a1fa16883acb`, fresh build of `pe_map` and the exe fixtures (tls_slot0, host, pause, enroll, process_image, startup/package_ordinal exes): - `x2w_pipe.py win2025 2465 --force --targets pe_map,cpu_exe_tls_slot0,cpu_exe_tls_slot0_host,cpu_exe_tls_slot0_pause,cpu_exe_tls_slot0_enroll,cpu_exe_process_image,cpu_package_ordinal_exe,cpu_package_ordinal_exe_return,cpu_startup_exe,cpu_startup_exe_create,cpu_startup_exe_linger,cpu_startup_exe_linger_return,cpu_startup_exe_timeout --regex 'cpu_native_package_ordinal_startup|cpu_native_startup|cpu_package_main_image|cpu_native_process_image|cpu_native_exe_tls_slot0'` - dev: 7/7 passed - release: 7/7 passed An earlier run of the same regex had 4 failures (tls_slot0, tls_slot0_enroll, process_image, package_main_image). The cause was a target list that left out `pe_map` and the fixtures, so old binaries ran. With them built, all pass. AI-assisted; commands listed were executed locally.
chatgpt-codex-connector[bot commented 2026-11-25 18:01:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T17:30:37Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T17:32:09.986127Z ccad283 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7169605491 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2465#issuecomment-7169605491). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T17:30:37Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"ccad2835e8702db697da23f40553a1fa16883acb","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-25T17:32:09.986127Z">2026-11-25T17:32:09.986127Z</relative-time> | `ccad283` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
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!2457
No description provided.