cpu: terminate the native EXE after its entry returns #394

Manually merged
github merged 1 commit from gh-pr/394/head into gh-pr/394/base 2026-11-26 21:48:29 +00:00
Owner

@⁠RonLogic on GitHub · 2026-11-22 00:13 UTC · original
RonLogic:cpu/native-exe-termination → main · +287 −13 · 8 files · 1 commits · merged 2026-11-22 00:55 UTC

Refs #281.

The CRT-free comparison EXE now enters a small startup wrapper. After the shared entry returns, the fixture's I/O provider compares the image base with the main process module. A native process calls ExitProcess with the entry's DWORD. The exact same image returns that DWORD to its host when run through pe_map_run. AOT explicitly targets the unwind-bounded native_entry export. The return-based body, mapper, and existing PE header guards remain in use.

The new regression starts a worker and waits for its readiness event. It checks the exit status and both pipe EOFs on the native and AOT paths for both selectors and empty stdin. On the mapped path, a separate marker confirms that the host resumes after running the same image. A temporary copy with its startup RVA changed to the original body exercises the failing case and records process, entry thread, live threads, and pipe state before it is cleaned up.

Linux validation: Python checks and documentation checks passed. LLVM MASM and GNU PE linking verified the wrapper and body layout. The wrapped image's exported body produced byte-for-byte identical generated C++ to the direct-entry control, and the PE header guards passed.

Windows CI on c32318a passed on Windows Server 2025 with MSVC 19.52.37029. All 42 CPU tests passed, including cpu_aot_exe_entry, cpu_native_exe_chain, and cpu_native_exe_termination. The full non-hardware suite had 117 passes and two WARP capability skips. Both Linux CI jobs passed.

ctest --preset dev --no-tests=error -E '_hardware$'

This change is independent of #247, #253 and #256. It overlaps with their EXE test registration or translation entry selection. A bounded repeat on the original reproducing machine would supply follow-up evidence about the intermittent case.

**@⁠RonLogic** on GitHub · 2026-11-22 00:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/394) `RonLogic:cpu/native-exe-termination` → `main` · +287 −13 · 8 files · 1 commits · merged 2026-11-22 00:55 UTC Refs #281. The CRT-free comparison EXE now enters a small startup wrapper. After the shared entry returns, the fixture's I/O provider compares the image base with the main process module. A native process calls `ExitProcess` with the entry's DWORD. The exact same image returns that DWORD to its host when run through `pe_map_run`. AOT explicitly targets the unwind-bounded `native_entry` export. The return-based body, mapper, and existing PE header guards remain in use. The new regression starts a worker and waits for its readiness event. It checks the exit status and both pipe EOFs on the native and AOT paths for both selectors and empty stdin. On the mapped path, a separate marker confirms that the host resumes after running the same image. A temporary copy with its startup RVA changed to the original body exercises the failing case and records process, entry thread, live threads, and pipe state before it is cleaned up. Linux validation: Python checks and documentation checks passed. LLVM MASM and GNU PE linking verified the wrapper and body layout. The wrapped image's exported body produced byte-for-byte identical generated C++ to the direct-entry control, and the PE header guards passed. [Windows CI on `c32318a`](https://github.com/R0Y00/Xbox2Windows/actions/runs/44965595148) passed on Windows Server 2025 with MSVC 19.52.37029. All 42 CPU tests passed, including `cpu_aot_exe_entry`, `cpu_native_exe_chain`, and `cpu_native_exe_termination`. The full non-hardware suite had 117 passes and two WARP capability skips. Both Linux CI jobs passed. ```powershell ctest --preset dev --no-tests=error -E '_hardware$' ``` This change is independent of #247, #253 and #256. It overlaps with their EXE test registration or translation entry selection. A bounded repeat on the original reproducing machine would supply follow-up evidence about the intermittent case.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:48:27 +00:00
github manually merged commit c32318a4c7 into gh-pr/394/base 2026-11-26 21:48:29 +00:00
Author
Owner

@⁠abilliontokens on GitHub · 2026-11-22 00:41 UTC · original

Bounded verification of #394 at c32318a4c7a3cebcdd6409eca4af6e9d0c02e52b on this reproducing machine, as requested above. The wrapper eliminates the hang signature here — both statistically and with a deliberately live worker.

Environment

  • Windows 11 Pro build 26200.9711, x64; MSVC 14.44.35207 (VS 2022 Build Tools 17.14), Debug preset, CMake 4.4.3, Ninja 1.13.2, Python 3.12.10
  • PR #394 head c32318a4, built with the dev preset in an isolated worktree. Wrapped binaries:
Binary SHA-256
cpu_exe_original.exe 8964c971b0239ba78fb55947763c3a2b2febd2ea1184abab5c59107db6ffa6a3
cpu_exe_io.dll 2596edcbbc96711d03ddda28a43b5e65b7f9daf752ae2b259778b50b440fb6a6
cpu_import_provider.dll dc9318dc5f87d687ab43229ee1a724cb827caf9be17a171806f02c4450b2547b

Launch series (pinned probe, quiet host)

Probe: https://gist.github.com/abilliontokens/15e0ef77afd0512acb21fc540417e62a/74a3882975692c728d0748fd4846a5c35fa69c55 — python probe281_threads.py <launches> <build-dir>, alternating selector bytes, 5 s timeout, diagnostics before kill.

Series Image Launches Timeouts Exit/output
Baseline control unwrapped main (9bdbb20, exe 4304efc1…) 41 (stopped at first timeout) 1 launch 40, selector 0: handle unsignaled, all expected bytes delivered, no EOF on either pipe — the same signature as the earlier captures
Wrapped, normal #394 c32318a4 1500 0 every launch exited with the expected code (750 × 0x60d, 750 × 0x57; the probe aborts on any unexpected exit), both pipes EOF
Wrapped, live worker #394 c32318a4, CPU_EXE_TEST_LIVE_WORKER=1 300 0 same: expected codes, both pipes EOF — the deterministically parked worker no longer keeps the process alive

The baseline control reproduced on the same machine, same session, before the wrapped series ran.

Test results at c32318a4

ctest --test-dir out/build/dev-394 --no-tests=error -R '^(cpu_native_exe_termination|cpu_native_exe_chain|cpu_aot_exe_entry|cpu_native_exe_start|cpu_native_startup)$' --output-on-failure
ctest --test-dir out/build/dev-394 --no-tests=error --output-on-failure
  • Group: 5/5 passed, including cpu_native_exe_termination (5.5 s) — event-confirmed live worker before entry return, native process handle signals + both EOFs + exact bytes/exit for both selectors and empty stdin, the unwrapped negative control stalls as expected, and the mapped path returns to its host (mapped host returned).
  • Full suite: 147/147 passed; capability skips reported separately: bvh_wave64_hardware (NVIDIA lanes 32..32), bvh_wave64_warp (WARP 4..4), wave_shuffle_warp (width-4 self-inverse). The #249 same-image chain (cpu_native_exe_chain) and the AOT comparison pass on the wrapped image.

Limits

This confirms the candidate on this reproducing environment (Windows 26200.9711, this driver/loader state); it is not a run on the original reporter's machine. No launch stalled in the wrapped series, so there are no new stall diagnostics to compare. Worker-creator identification remains the separate track noted above.

AI-assisted; runs executed locally on the configuration above.

**@⁠abilliontokens** on GitHub · 2026-11-22 00:41 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/394#issuecomment-7071719888) Bounded verification of #394 at `c32318a4c7a3cebcdd6409eca4af6e9d0c02e52b` on this reproducing machine, as requested above. The wrapper eliminates the hang signature here — both statistically and with a deliberately live worker. ### Environment - Windows 11 Pro build **26200.9711**, x64; MSVC 14.44.35207 (VS 2022 Build Tools 17.14), Debug preset, CMake 4.4.3, Ninja 1.13.2, Python 3.12.10 - PR #394 head `c32318a4`, built with the `dev` preset in an isolated worktree. Wrapped binaries: | Binary | SHA-256 | | --- | --- | | `cpu_exe_original.exe` | `8964c971b0239ba78fb55947763c3a2b2febd2ea1184abab5c59107db6ffa6a3` | | `cpu_exe_io.dll` | `2596edcbbc96711d03ddda28a43b5e65b7f9daf752ae2b259778b50b440fb6a6` | | `cpu_import_provider.dll` | `dc9318dc5f87d687ab43229ee1a724cb827caf9be17a171806f02c4450b2547b` | ### Launch series (pinned probe, quiet host) Probe: https://gist.github.com/abilliontokens/15e0ef77afd0512acb21fc540417e62a/74a3882975692c728d0748fd4846a5c35fa69c55 — `python probe281_threads.py <launches> <build-dir>`, alternating selector bytes, 5 s timeout, diagnostics before kill. | Series | Image | Launches | Timeouts | Exit/output | | --- | --- | ---: | ---: | --- | | Baseline control | unwrapped `main` (`9bdbb20`, exe `4304efc1…`) | 41 (stopped at first timeout) | **1** | launch 40, selector 0: handle **unsignaled**, all expected bytes delivered, **no EOF** on either pipe — the same signature as the earlier captures | | Wrapped, normal | #394 `c32318a4` | **1500** | **0** | every launch exited with the expected code (750 × `0x60d`, 750 × `0x57`; the probe aborts on any unexpected exit), both pipes EOF | | Wrapped, live worker | #394 `c32318a4`, `CPU_EXE_TEST_LIVE_WORKER=1` | **300** | **0** | same: expected codes, both pipes EOF — the deterministically parked worker no longer keeps the process alive | The baseline control reproduced on the same machine, same session, before the wrapped series ran. ### Test results at `c32318a4` ```powershell ctest --test-dir out/build/dev-394 --no-tests=error -R '^(cpu_native_exe_termination|cpu_native_exe_chain|cpu_aot_exe_entry|cpu_native_exe_start|cpu_native_startup)$' --output-on-failure ctest --test-dir out/build/dev-394 --no-tests=error --output-on-failure ``` - Group: **5/5 passed**, including `cpu_native_exe_termination` (5.5 s) — event-confirmed live worker before entry return, native process handle signals + both EOFs + exact bytes/exit for both selectors and empty stdin, the unwrapped negative control stalls as expected, and the mapped path returns to its host (`mapped host returned`). - Full suite: **147/147 passed**; capability skips reported separately: `bvh_wave64_hardware` (NVIDIA lanes 32..32), `bvh_wave64_warp` (WARP 4..4), `wave_shuffle_warp` (width-4 self-inverse). The #249 same-image chain (`cpu_native_exe_chain`) and the AOT comparison pass on the wrapped image. ### Limits This confirms the candidate on this reproducing environment (Windows 26200.9711, this driver/loader state); it is not a run on the original reporter's machine. No launch stalled in the wrapped series, so there are no new stall diagnostics to compare. Worker-creator identification remains the separate track noted above. _AI-assisted; runs executed locally on the configuration above._
This discussion has been locked. Commenting is limited to contributors.
No description provided.