Windows: guest_ampr_markers fails intermittently with a fixed guest mapping at 0xec00000000 overlapping a host region #3371

Closed
opened 2026-10-11 09:16:04 +00:00 by screamm · 3 comments
screamm commented 2026-10-11 09:16:04 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-11T09:16:04Z.


On Windows, guest_ampr_markers fails intermittently with

what():  fixed guest mapping 0xec00000000+0x1000000000 overlaps a host region in the guest arena

(exit 0xc0000409). Measured today on builds of main 0c617bae plus one unrelated single-library branch each (libSceContentSearch, libSceAmpr _Throw_Cpp_error): in a -j8 suite run it failed once in each of two runs, and run alone it failed 1 of 6 and 1 of 10 repeats (--repeat until-fail), passing the rest. Other Ampr tests on the same binaries pass repeatedly. The failing run aborts before any marker check, so the 64 GiB fixed mapping the test (or the library's arena setup) requests at 0xec00000000 collides with whatever the host loader happened to place there; the address of the host region is not printed.

Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, 16 logical CPUs, 64 GiB RAM, NVIDIA RTX 4070.

Not seen on Linux here (no Linux host). If a maintainer wants the overlapping host region, I can add a diagnostic print locally and report the module.

Written with Claude Code assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5799727730 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3371). Originally posted by [screamm](https://github.com/screamm) on 2026-10-11T09:16:04Z. --- On Windows, `guest_ampr_markers` fails intermittently with ``` what(): fixed guest mapping 0xec00000000+0x1000000000 overlaps a host region in the guest arena ``` (exit `0xc0000409`). Measured today on builds of `main` `0c617bae` plus one unrelated single-library branch each (libSceContentSearch, libSceAmpr `_Throw_Cpp_error`): in a `-j8` suite run it failed once in each of two runs, and run alone it failed 1 of 6 and 1 of 10 repeats (`--repeat until-fail`), passing the rest. Other Ampr tests on the same binaries pass repeatedly. The failing run aborts before any marker check, so the 64 GiB fixed mapping the test (or the library's arena setup) requests at `0xec00000000` collides with whatever the host loader happened to place there; the address of the host region is not printed. Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, 16 logical CPUs, 64 GiB RAM, NVIDIA RTX 4070. Not seen on Linux here (no Linux host). If a maintainer wants the overlapping host region, I can add a diagnostic print locally and report the module. Written with Claude Code assistance.
Zurisen commented 2026-10-11 10:14:27 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Zurisen on 2026-10-11T10:14:27Z.


The host regions are thread stacks. I logged every non-free region the arena finds in [0xec00000000, 0xfc00000000) when it reserves itself (VirtualQuery in Arena(), GuestArena.cpp). In every failing run there were two MEM_PRIVATE regions of the shape of a Windows thread stack: a 2 MiB reservation, its top pages committed, with a PAGE_GUARD | PAGE_READWRITE page below them, at random addresses (0xf278e00000, 0xf025400000, 0xf0dfa00000 in three failing runs). There were none in passing runs. These are the threads that exist before the arena is reserved (the main thread and the loader's workers), which Windows places at random. The arena keeps them as holes, and the AMM reservation from #3281 then asks for the last 64 GiB at a fixed address: arenaBase + arenaBytes - 2 * AmmRangeBytes = 0xec00000000, with GuestMapFixed | GuestMapNoOverwrite, which throws when a stack sits there. Here that was 3 of 40 to 1 of 15 runs alone, depending on the batch.

Fix branch: Zurisen:fix/amm-below-host-regions (one commit on main a4d5d3ce).

  • libc: GuestArenaHighestFree_nid_no_patch(bytes, alignment) returns the highest free aligned window of the arena, searching its used ranges (which include the host holes) from the top.
  • libkernel Apr.cpp: the AMM ranges are reserved at that window (2 MiB alignment) instead of at the fixed address. When the last 64 GiB is free, which is the usual case, that is the same 0xec00000000 as now. When a stack sits in it, the window ends just below the stack. It still throws if the arena has no free 64 GiB. This keeps #3281's reason for the top placement (the far end from the title's hinted maps); the PR notes the console's AMM address is not known.
  • Test: the new guest_amm_placement marks the last 4 MiB of the arena used before the AMM's first use, standing in for a stack, and requires the AMM ranges below it and within 1 GiB of it. On main it fails every run with this issue's message, once with a real stack (overlaps a host region). GuestAmpr.cpp's multimapEnd == arenaBase + arenaBytes becomes "inside the arena and above the hinted maps".

Windows 11 Home (26200), WinLibs GCC 15.2.0 r7, Release, RTX 4070 Laptop:

  • guest_amm_placement: 5/5.
  • guest_ampr_markers: 40/40 alone (main: 3 of 40 to 1 of 15).
  • Full ctest -j6 --repeat until-fail:3: the failures also fail on main here: pr_overlap_encoding (Python 3.10), windows_exceptions, and the guest_process_time* flake from #3422.
  • Conventions check passes.

PR intake is limited, so I have not opened a PR; anyone eligible is welcome to carry the commit.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107960895 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3371#issuecomment-6107960895). Originally posted by [Zurisen](https://github.com/Zurisen) on 2026-10-11T10:14:27Z. --- The host regions are thread stacks. I logged every non-free region the arena finds in `[0xec00000000, 0xfc00000000)` when it reserves itself (`VirtualQuery` in `Arena()`, `GuestArena.cpp`). In every failing run there were two `MEM_PRIVATE` regions of the shape of a Windows thread stack: a 2 MiB reservation, its top pages committed, with a `PAGE_GUARD | PAGE_READWRITE` page below them, at random addresses (`0xf278e00000`, `0xf025400000`, `0xf0dfa00000` in three failing runs). There were none in passing runs. These are the threads that exist before the arena is reserved (the main thread and the loader's workers), which Windows places at random. The arena keeps them as holes, and the AMM reservation from #3281 then asks for the last 64 GiB at a fixed address: `arenaBase + arenaBytes - 2 * AmmRangeBytes` = `0xec00000000`, with `GuestMapFixed | GuestMapNoOverwrite`, which throws when a stack sits there. Here that was 3 of 40 to 1 of 15 runs alone, depending on the batch. Fix branch: [`Zurisen:fix/amm-below-host-regions`](https://github.com/Zurisen/AnyPS5/commit/ff8a615bb) (one commit on `main` `a4d5d3ce`). - **libc:** `GuestArenaHighestFree_nid_no_patch(bytes, alignment)` returns the highest free aligned window of the arena, searching its used ranges (which include the host holes) from the top. - **libkernel `Apr.cpp`:** the AMM ranges are reserved at that window (2 MiB alignment) instead of at the fixed address. When the last 64 GiB is free, which is the usual case, that is the same `0xec00000000` as now. When a stack sits in it, the window ends just below the stack. It still throws if the arena has no free 64 GiB. This keeps #3281's reason for the top placement (the far end from the title's hinted maps); the PR notes the console's AMM address is not known. - **Test:** the new `guest_amm_placement` marks the last 4 MiB of the arena used before the AMM's first use, standing in for a stack, and requires the AMM ranges below it and within 1 GiB of it. On `main` it fails every run with this issue's message, once with a real stack (`overlaps a host region`). `GuestAmpr.cpp`'s `multimapEnd == arenaBase + arenaBytes` becomes "inside the arena and above the hinted maps". Windows 11 Home (26200), WinLibs GCC 15.2.0 r7, Release, RTX 4070 Laptop: - `guest_amm_placement`: 5/5. - `guest_ampr_markers`: 40/40 alone (`main`: 3 of 40 to 1 of 15). - Full `ctest -j6 --repeat until-fail:3`: the failures also fail on `main` here: `pr_overlap_encoding` (Python 3.10), `windows_exceptions`, and the `guest_process_time*` flake from #3422. - Conventions check passes. PR intake is limited, so I have not opened a PR; anyone eligible is welcome to carry the commit.
Amoenus commented 2026-10-11 10:28:47 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Amoenus on 2026-10-11T10:28:47Z.


Maintained independent Windows observations (2026-10-12)

The merged #3683 change is now applied locally as cb2c3a7c5, with credit to its upstream authors, on our pinned-main a672688e integration. Highest-free-window placement passes 200/200 guest_amm_placement and200/200 guest_ampr_markers native Windows runs. Replacing only the new placement calculation with the former fixed address rejects5/5 occupied-top controls with the expected overlap diagnostic. Original source bytes restored; full build/libs and placement/markers/threads groups ×5 pass again.

With the separate cache-fixture correction, full870-test suite: 865pass/0fail/5 explicit skips, maximum15.57s. Normal before/changed twice/restored PPSA99902 controls reach60s without a fatal diagnostic; they do not by themselves establish late startup or gameplay. Original dump/converted module/exact123-file runtime baseline restored and verified. Windows11 Enterprise26200/WinLibs GCC15.2 r7/Release, RTX5080. This is a finite native verification of the adapted integration, not whole unchanged-PR-head, Linux or console-AMM-address validation.

Historical observations: the older fixed-placement integrations had intermittent 0xc0000409 collisions at 0xec00000000+0x1000000000. The last finite batch passed20/20 earlier-library controls and18/20 later controls, with native libc/kernel/Ampr byte-identical; the counts were not a failure-rate estimate. Earlier a73/math observations and logs are retained. No new issue needed; this comment is updated in place. AI-assisted validation/report: Codex.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108079462 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3371#issuecomment-6108079462). Originally posted by [Amoenus](https://github.com/Amoenus) on 2026-10-11T10:28:47Z. --- ### Maintained independent Windows observations (2026-10-12) The merged [#3683](https://github.com/boykopovar/AnyPS5/pull/3683) change is now applied locally as `cb2c3a7c5`, with credit to its upstream authors, on our pinned-main `a672688e` integration. Highest-free-window placement passes **200/200 `guest_amm_placement` and200/200 `guest_ampr_markers`** native Windows runs. Replacing only the new placement calculation with the former fixed address rejects5/5 occupied-top controls with the expected overlap diagnostic. Original source bytes restored; full build/libs and placement/markers/threads groups ×5 pass again. With the separate cache-fixture correction, full870-test suite: **865pass/0fail/5 explicit skips**, maximum15.57s. Normal before/changed twice/restored PPSA99902 controls reach60s without a fatal diagnostic; they do not by themselves establish late startup or gameplay. Original dump/converted module/exact123-file runtime baseline restored and verified. Windows11 Enterprise26200/WinLibs GCC15.2 r7/Release, RTX5080. This is a finite native verification of the adapted integration, not whole unchanged-PR-head, Linux or console-AMM-address validation. Historical observations: the older fixed-placement integrations had intermittent `0xc0000409` collisions at `0xec00000000+0x1000000000`. The last finite batch passed20/20 earlier-library controls and18/20 later controls, with native libc/kernel/Ampr byte-identical; the counts were not a failure-rate estimate. Earlier a73/math observations and logs are retained. No new issue needed; this comment is updated in place. AI-assisted validation/report: Codex.
blawesom commented 2026-10-11 12:22:31 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T12:22:31Z.


Data point from Linux: not reproducible here. 100 consecutive ctest -R '^guest_ampr_markers' runs (CachyOS, kernel 7.2.9, GCC 16.2.1, Release, AMD RX 9070 XT) — 0 failures, every run including the fixed guest mapping setup.

That is consistent with the diagnosis in the report: the abort happens when the host loader happens to place a region inside the fixed 64 GiB mapping at 0xec00000000. On Linux the loader keeps shared libraries and mappings near 0x7f..., far from 0xec..., so the collision never occurs — pointing at Windows ASLR placement as the trigger rather than a race in the test or the arena setup itself.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108972814 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3371#issuecomment-6108972814). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-11T12:22:31Z. --- Data point from Linux: not reproducible here. 100 consecutive `ctest -R '^guest_ampr_markers'` runs (CachyOS, kernel 7.2.9, GCC 16.2.1, Release, AMD RX 9070 XT) — **0 failures**, every run including the fixed guest mapping setup. That is consistent with the diagnosis in the report: the abort happens when the host loader happens to place a region inside the fixed 64 GiB mapping at `0xec00000000`. On Linux the loader keeps shared libraries and mappings near `0x7f...`, far from `0xec...`, so the collision never occurs — pointing at Windows ASLR placement as the trigger rather than a race in the test or the arena setup itself.
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
boykopovar/AnyPS5#3371
No description provided.