cpu: cpu_native_startup and cpu_native_package_ordinal_startup fail on main since #1151 #2449

Closed
opened 2026-11-25 17:15:34 +00:00 by Makto94 · 1 comment
Makto94 commented 2026-11-25 17:15:34 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Makto94 on 2026-11-25T17:15:34Z.


Two tests fail on current main and pass when 280abb58 (#1151, "pe: report the pe_map main EXE as the process image") is reverted.

Environment: Windows 11 Pro build 26300.9974, Debug (dev preset), MSVC 19.44.35230.0. Commit under test: e06aca8b. Serial run (-j1).

Command:

ctest --preset dev --no-tests=error -j1 -R '^cpu_native_(package_ordinal_)?startup$' --output-on-failure

Observed on e06aca8b: 0/2 passed.

  • cpu_native_package_ordinal_startup: package_ordinal_check.py:61 assertion. pe_run_package.py ... cpu_package_ordinal_exe.exe returned returncode=13, with empty stdout and stderr.
  • cpu_native_startup: native_startup_check.py:216 raises "package runner failed", returncode=16974350 (0x103020e). Stdout has the LOG, THREADS and TLS lines but no runner JSON.

The two return codes are the fixtures' own results. package_ordinal_exe.cpp returns 13 on success (exe_finish(result)), and the native run of cpu_startup_exe.exe logs exit 0x103020e.

Expected: 2/2 passed, as before 280abb58.

Control: the same commit with git revert --no-commit 280abb58 (it applies without conflicts), same command: 2/2 passed.

Reproduce:

git checkout e06aca8b
.\tools\dev.ps1; cmake --preset dev; cmake --build --preset dev
ctest --preset dev --no-tests=error -j1 -R '^cpu_native_(package_ordinal_)?startup$' --output-on-failure
git revert --no-commit 280abb58
cmake --build --preset dev
ctest --preset dev --no-tests=error -j1 -R '^cpu_native_(package_ordinal_)?startup$' --output-on-failure

CI on main (push): the last green run is on e33578e1. git log --oneline e33578e1..beabd641 contains 280abb58. Runs between those two commits were cancelled. The run on beabd641 (45636231471) concluded failure: its "Build and test on Windows" and "Build and test on Windows at /O2" jobs fail on these same two tests. They fail on the same two tests in run 45642462400 (7092683a) and run 45653402072 (f39050c6).

Likely cause (code reading, not traced): both fixtures end through exe_finish in tests/cpu/exe_exit.h, not through finish_exe in tests/cpu/exe_io.cpp. exe_exit::started_as_process() compares the PEB's ImageBaseAddress (peb()+0x10) with __ImageBase. Since 280abb58, pe_map_run_main writes the mapped EXE's base into ImageBaseAddress, so under pe_map this check is true and exe_finish calls RtlExitUserProcess(code), which ends the runner process. 280abb58 changed the equivalent check in finish_exe (it now also requires the image to be in the loader's module list). It did not change exe_exit.h, whose comment on started_as_process() still says that in a pe_map host ImageBaseAddress names the host EXE.

With only started_as_process() changed to compare the DllBase of the first InLoadOrderModuleList entry with __ImageBase (the 280abb58 commit message states that the PEB loader list is not changed), both tests pass on e06aca8b plus that change (local, Debug), and ctest --preset dev --no-tests=error -j1 -R '^cpu_' passes 280/280. A PR with this change follows.

Not measured:

  • Whether tests outside ^cpu_ are affected by the regression locally.
  • Whether RtlExitUserProcess is the call that ends the runner process (no trace was taken).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6609784359 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2457). Originally posted by [Makto94](https://github.com/Makto94) on 2026-11-25T17:15:34Z. --- Two tests fail on current `main` and pass when `280abb58` (#1151, "pe: report the pe_map main EXE as the process image") is reverted. Environment: Windows 11 Pro build 26300.9974, Debug (`dev` preset), MSVC 19.44.35230.0. Commit under test: `e06aca8b`. Serial run (`-j1`). Command: ```powershell ctest --preset dev --no-tests=error -j1 -R '^cpu_native_(package_ordinal_)?startup$' --output-on-failure ``` Observed on `e06aca8b`: 0/2 passed. - `cpu_native_package_ordinal_startup`: `package_ordinal_check.py:61` assertion. `pe_run_package.py ... cpu_package_ordinal_exe.exe` returned `returncode=13`, with empty stdout and stderr. - `cpu_native_startup`: `native_startup_check.py:216` raises "package runner failed", `returncode=16974350` (`0x103020e`). Stdout has the `LOG`, `THREADS` and `TLS` lines but no runner JSON. The two return codes are the fixtures' own results. `package_ordinal_exe.cpp` returns 13 on success (`exe_finish(result)`), and the native run of `cpu_startup_exe.exe` logs `exit 0x103020e`. Expected: 2/2 passed, as before `280abb58`. Control: the same commit with `git revert --no-commit 280abb58` (it applies without conflicts), same command: 2/2 passed. Reproduce: ```powershell git checkout e06aca8b .\tools\dev.ps1; cmake --preset dev; cmake --build --preset dev ctest --preset dev --no-tests=error -j1 -R '^cpu_native_(package_ordinal_)?startup$' --output-on-failure git revert --no-commit 280abb58 cmake --build --preset dev ctest --preset dev --no-tests=error -j1 -R '^cpu_native_(package_ordinal_)?startup$' --output-on-failure ``` CI on `main` (push): the last green run is on `e33578e1`. `git log --oneline e33578e1..beabd641` contains `280abb58`. Runs between those two commits were cancelled. The run on `beabd641` (45636231471) concluded `failure`: its "Build and test on Windows" and "Build and test on Windows at /O2" jobs fail on these same two tests. They fail on the same two tests in run 45642462400 (`7092683a`) and run 45653402072 (`f39050c6`). Likely cause (code reading, not traced): both fixtures end through `exe_finish` in `tests/cpu/exe_exit.h`, not through `finish_exe` in `tests/cpu/exe_io.cpp`. `exe_exit::started_as_process()` compares the PEB's `ImageBaseAddress` (`peb()+0x10`) with `__ImageBase`. Since `280abb58`, `pe_map_run_main` writes the mapped EXE's base into `ImageBaseAddress`, so under `pe_map` this check is true and `exe_finish` calls `RtlExitUserProcess(code)`, which ends the runner process. `280abb58` changed the equivalent check in `finish_exe` (it now also requires the image to be in the loader's module list). It did not change `exe_exit.h`, whose comment on `started_as_process()` still says that in a pe_map host `ImageBaseAddress` names the host EXE. With only `started_as_process()` changed to compare the `DllBase` of the first `InLoadOrderModuleList` entry with `__ImageBase` (the `280abb58` commit message states that the PEB loader list is not changed), both tests pass on `e06aca8b` plus that change (local, Debug), and `ctest --preset dev --no-tests=error -j1 -R '^cpu_'` passes 280/280. A PR with this change follows. Not measured: - Whether tests outside `^cpu_` are affected by the regression locally. - Whether `RtlExitUserProcess` is the call that ends the runner process (no trace was taken).
tedin7 commented 2026-11-25 18:01:20 +00:00 (Migrated from github.com)
Author
Contributor

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


Working on a fix in tests/cpu/exe_exit.h; Draft PR shortly. AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7169479531 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2457#issuecomment-7169479531). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T17:25:20Z. --- Working on a fix in tests/cpu/exe_exit.h; Draft PR shortly. AI-assisted; commands listed were executed locally.
Sign in to join this conversation.
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#2449
No description provided.