Windows: guest_ampr_markers fails intermittently with a fixed guest mapping at 0xec00000000 overlapping a host region #3371
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-11T09:16:04Z.
On Windows,
guest_ampr_markersfails intermittently with(exit
0xc0000409). Measured today on builds ofmain0c617baeplus one unrelated single-library branch each (libSceContentSearch, libSceAmpr_Throw_Cpp_error): in a-j8suite 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 at0xec00000000collides 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.
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 (VirtualQueryinArena(),GuestArena.cpp). In every failing run there were twoMEM_PRIVATEregions of the shape of a Windows thread stack: a 2 MiB reservation, its top pages committed, with aPAGE_GUARD | PAGE_READWRITEpage below them, at random addresses (0xf278e00000,0xf025400000,0xf0dfa00000in 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, withGuestMapFixed | 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 onmaina4d5d3ce).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.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 same0xec00000000as 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.guest_amm_placementmarks 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. Onmainit fails every run with this issue's message, once with a real stack (overlaps a host region).GuestAmpr.cpp'smultimapEnd == arenaBase + arenaBytesbecomes "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).ctest -j6 --repeat until-fail:3: the failures also fail onmainhere:pr_overlap_encoding(Python 3.10),windows_exceptions, and theguest_process_time*flake from #3422.PR intake is limited, so I have not opened a PR; anyone eligible is welcome to carry the commit.
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-maina672688eintegration. Highest-free-window placement passes 200/200guest_amm_placementand200/200guest_ampr_markersnative 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
0xc0000409collisions at0xec00000000+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.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 near0x7f..., far from0xec..., 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.