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

Manually merged
github merged 1 commit from gh-pr/2465/head into gh-pr/2465/base 2026-11-27 00:54:17 +00:00
Owner

@⁠tedin7 on GitHub · 2026-11-25 17:25 UTC · original
tedin7:fix-2457-exe-exit → main · +10 −2 · 1 files · 1 commits · merged 2026-11-25 17:32 UTC

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.

**@⁠tedin7** on GitHub · 2026-11-25 17:25 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2465) `tedin7:fix-2457-exe-exit` → `main` · +10 −2 · 1 files · 1 commits · merged 2026-11-25 17:32 UTC 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:54:14 +00:00
github manually merged commit ccad2835e8 into gh-pr/2465/base 2026-11-27 00:54:17 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 17:30 UTC · original

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.

**@⁠tedin7** on GitHub · 2026-11-25 17:30 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2465#issuecomment-7169600451) 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.
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-25 17:30 UTC · original · edited 2026-11-25 17:32 UTC

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.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-25 17:30 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2465#issuecomment-7169605491) · edited 2026-11-25 17:32 UTC <!-- 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>
This discussion has been locked. Commenting is limited to contributors.
No description provided.