runtime: serve a refused slot 148 upload page from a CPU reserve #3732
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3732"
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 R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-12-01T12:44:32Z.
Problem
The console builder module fills 32-byte records through the pointer command-list slot 148 returns and never checks it. In a local full-stack x64 run at 164.71 s (a local integration of
mainate1161e43with #3728) the first 8-byte store of that loop faulted at address 0:mov [rcx+rsi], raxwithrcx = 0,rsi = 0, reported parameters0x1(write) and0x0.The line logged immediately before it named the producer:
x2w_upload::Arena::allocatecreates one desktop upload page per recording on its first request, andCreateCommittedResourcereturnedE_OUTOFMEMORYunder the run's memory pressure. The same interval logged DirectStorageout of memoryand a listClosefailure with0x8007000e. The arena returned an empty allocation, slot 148 returned null, and the title stored through it.Change
A slot 148 request that no upload page can back is served from a bounded, process-wide CPU reserve (
src/startup_stubs/list_upload_pages.h):Allocation::cpu_onlymarks the slice: zeroed, aligned, writable,gpu = 0, no resource.CpuReserveasks for one region withVirtualAlloc(4 MiB, falling back to 256 KiB and then 64 KiB) when an upload page first succeeds, so the memory exists before the run needs it. It is bounded and never grows.Arena::rangeandArena::translateonly see page-backed allocations, so a reserved range has no desktop address. The index-view, root-SRV and indirect-record paths already refuse a range they cannot map; a graphics root SRV falls back to the existing 64 KiB title-memory copy.-> CPU reserve, no GPU address, or the previous null line once the reserve is spent, and the presentation heartbeat reports the slice count and bytes.Evidence and tests
Windows 11 26200, MSVC 14.44,
cmake --preset release(warm tree, full build exit 0):Result: 15 passed, 0 failed, 0 skipped. The hardware cases ran on AMD Radeon RX 9060 XT, driver 32.0.32029.2010, debug layer as configured by each test.
tests/docs_links_check.pypassed (208 Markdown files, 802 links).The new fixture
tests/startup_upload_reserve.cpp(registered asstartup_upload_reservefromtests/cmake/startup_upload_reserve.cmake, added to theprbuild targets and test filter) replaces the page maker, so both outcomes run without a device or an upload heap:translatemaps the full range and refuses a longer one, the page rolls over when it cannot cover a request, and 17 32-byte records fill and read back;E_OUTOFMEMORYas in the observed run: the allocation is non-null andcpu_only,translate/rangerefuse it, and the same record fill lands in the reserve without touching address 0;Negative control: with
Arena::allocatechanged toreturn {}after a failed page (one line), the fixture fails withupload reserve contract failed: refused page returned null(exit 5). Restored, it passes.Limits
+0x1c667,+0x13a32,+0xd772,+0xec7eand+0x216e1, and itsd3d12_xs.dll+0x6290entry is the first byte of a nine-byte function, so that entry is a candidate rather than a return address. No PDB exists for that local build.Refs #870
Refs #3451
Refs #3639
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-01T14:14:04Z.
Review: COMMENTED
Please handle CPU-reserve addresses explicitly in the graphics root SRV path. They are absent from the arena lookup, so with the bind-time copy enabled, list_root_srv treats a reserve slice as general application memory and uses a readable window of up to 64 KiB. That window can extend past the slice into adjacent allocations in the same committed region and can trigger another upload while under memory pressure.
Could the bind reject reserve addresses, or bound the copy to the originating slice? A regression check with two adjacent slices would cover this path. The current fixture checks the arena lookup only.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T18:46:47Z.
Review: COMMENTED
A trial merge of
5222b238into main after #3727 conflicts inCMakePresets.json. Please retain bothstartup_upload_reserveandstartup_mesh86_present_warpin the PR filter. I also checked the earlier root SRV finding on this revision.list_root_srvstill falls through to the genericreadable_windowcopy for a reserve address when the address has no GPU mapping and bind-time copy is enabled. Please address that review point before the next Windows run.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T06:50:38Z.
Review: APPROVED
Independently reviewed
c5afb411against main2710917d, including the slot 148 caller and lifetime of the process-wide reserve. The pre-existing argument and recording checks still run before allocation. CPU-only slices are not inserted in the lookup that supplies desktop addresses. On Windows 11 build 26300, I built tests/startup_upload_reserve.cpp as C++17 with MSVC and ran it; backed allocations, injected E_OUTOFMEMORY, the CPU-only mapping guard and the oversized refusal passed. Replacing the reserve return with an empty allocation failed with exit 5 and refused page returned null. The PR author reports 15/15 on Windows, including WARP and RX 9060 XT; my independent test is the device-free fixture. The reserve is bounded and does not supply a GPU upload page.