fix(libc): reserve the guest arena around what Windows already placed in it #196
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/196"
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 MichonGoddijn231849 on 2026-09-30T21:11:57Z.
What
On Windows the guest arena wanted one free range starting at 0x200000000, and took the first base and size that fit. Windows places thread stacks and other reservations at random low addresses before libc starts, so the range was often taken. The arena then moved up (to 0x2200000000 in the failing runs) or shrank to 0x1c00000000. Guest mappings at the fixed low addresses titles use then fell outside it, and the process aborted with
shared mapping outside the guest arena. The failure came and went between launches of the same title and build.reserveAroundwalks [0x200000000, 0x7200000000). It reserves every free, allocation-granularity-aligned piece as a placeholder, and records what lies between the pieces as used holes, as the arena already did for the system-reserved range.Releaseputs back any hole a released range overlapped, so a hole never becomes allocatable.Tested
Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB DDR5-5600, MinGW-w64 GCC 15.2.0.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-10-01T08:17:56Z.
This adds another fallback chain: if
reserveAroundreserves too little memory, it falls back to relocating or shrinking the arena. It also silently treatsVirtualQueryand reservation failures as occupied holes.These fallbacks are not allowed. Please implement one consistent arena reservation path that preserves the required address range. Occupied regions may be tracked as holes, but query or reservation failures must remain explicit errors. If the required arena cannot be established, throw instead of switching to a different layout.
Imported from boykopovar/AnyPS5. Originally posted by MichonGoddijn231849 on 2026-10-01T17:26:26Z.
Thanks for the review. Reworked as #231: the arena is always [0x200000000, 0x7200000000), occupied regions are holes, and a failed VirtualQuery or reservation throws; no relocating or shrinking.
Pull request closed