Windows tests: a start-up thread stack can land on the AGC driver memory at 0xfe0000000, so driver start-up fails with "replace guest placeholder with private memory" #18252
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 angrysandhill on 2026-11-11T00:21:31Z.
What happens
On Windows, a test that starts the AGC driver occasionally stops at start-up with
replace guest placeholder with private memory: Attempt to access invalid address(exit code0xc0000409). This happens when a host thread stack, created before libc reserves the guest arena, sits on the driver memory at0xfe0000000.Title, test or build step
Any test that starts the AGC driver. Seen here as
agc_driver_draw_cache_reuse_entry_verify, once in a parallel full-suite run while testing #15555, which this does not come from. #15564 records the same message on a Radeon iGPU in a parallel full-suite run.AnyPS5 commit
The occurrence was on
mainc5488026abwith #15555 merged on top, which changes neither the driver start-up nor libc. The reproduction below was onmain41b9e25.System
Windows 10 Home 22H2 (10.0.19045), AMD Radeon RX 6750 XT, AMD Software Adrenalin 26.10.1 (driver 32.0.21045.16010), WinLibs GCC 15.2.0 r7 UCRT, Release,
BUILD_TESTING=ON.Steps to reproduce
The natural rate is about once in tens of thousands of test processes, so the reproduction places the stack deliberately. It starts the test suspended and, before its loader runs, places a region shaped like a start-up thread stack at
0xfe0000000: 2 MiB reserved, with the top0x6000bytes committed and the lower half of those as guard pages. Then it resumes the test. Run with the test's ctest environment:It stops within about a second with exactly this message, 3 of 3 times.
inject.cppis below.inject.cpp (g++ -O2 -municode -static -o inject.exe inject.cpp)
Log
The natural occurrence:
Its return addresses, resolved against that build's symbols and checked against the call before each one:
The only driver call that commits
0xfe0000000isMapDriverMemory()(Execution/src/Driver/Lifecycle.cpp:85).What was checked
Why the address can be taken.
[0x10000, 0xFC00000000)when libc loads. Host memory already in that range stays a hole.WindowsMappings::Committakes anyMEM_RESERVEregion as a guest placeholder.HIGH_ENTROPY_VA. With it, Windows places the stacks of the start-up threads anywhere from 4 GiB to past 1 TiB. These are the main thread and the loader's worker threads, each a 2 MiB reservation.How often stacks land in the arena. A local libc build printed the arena's host holes and exited. Running
agc_driver_draw_cache_reuse_tests.exewith it 4,000 times gave:[0x7FFFFC000, 0x1000000000), which holds the driver memory.Injected host memory, each placed before the loader ran (
agc_driver_draw_cache_reuse_tests.exe,main41b9e25):0xfe0000000replace guest placeholder with private memory: Attempt to access invalid address0xfe0000000replace guest placeholder with private memory: Attempt to access invalid address0xfe0100000coalesce guest placeholders: Attempt to access invalid address0xfdff00000split guest placeholder prefix: Attempt to access invalid address0xfe01000000xff0000000Titles are not affected.
HIGH_ENTROPY_VAfor this same reason:0x140or0x100inWindowsPeWriter.cpp. The test executables were left with it.test_windows_address_space.pychecks that a title's main thread stack stays below0x200000000.agc_driver_frame_replay_relaunch_testsalready links with--disable-high-entropy-va, so that its stack is an arena host region in every process.With the high-entropy bit cleared. On the same executable with
HIGH_ENTROPY_VAcleared, all 1,000 runs had every host region below 0.053 GiB.Proposed fix. Link the test executables with
--disable-high-entropy-va, the layout titles get. I have a pull request for that. A check inCommitthat refuses host holes with a clear message could be added separately.AI-assisted: yes.