fix(agc): exclude host arena holes from write-watch proofs #3594
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3594"
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 Scramblrrrr on 2026-10-11T13:56:14Z.
What
Windows reserves the guest arena around existing host mappings. WriteTracker initializes coverage for the arena address interval, including those excluded host regions. A range inside a host-owned hole can therefore be reported as write-watched and sent to GetWriteWatch even though it was not allocated with MEM_WRITE_WATCH. Native copied-read reuse testing exposed error 87; debugger address layouts did not reproduce it.
Reject host-region overlaps before collecting or accepting write-watch proofs, including bulk unchanged queries. Collection returns zero (tracking unavailable), and eligibility/unchanged proofs return false, so callers take their existing fresh-copy or comparison path. The existing store path already excludes these regions. No exception suppression or assumption that untracked memory is unchanged is introduced.
The Windows regression enumerates an actual host exclusion inside the arena rather than depending on ASLR placement of a heap allocation. It checks eligibility, collection and both unchanged-query APIs, plus ordinary host-heap rejection and unchanged bytes. Guest memory is not dereferenced during arena enumeration. Related #2863 optimizes queue-worker write-watch walks; this correction addresses excluded-region eligibility. Depends on: none.
Tested
Head
56d08f2547, base maina11c8f7f70. Windows 11, Ryzen 7800X3D, Release MinGW GCC 15.2, SPIRV-Tools OFF.agc_driver_graphics: PASS, final run 4.81 seconds.an arena host hole was reported as write-watched(0.36 seconds). Restored the fix, explicitly rebuilt, and repeated the passing test.The correction was also tested in the separate 007 performance integration: six selected Vulkan checks passed. That experimental stack and its title data are not part of this PR. Its game runs still hit a host-memory guard and no visible frame was verified; this fix does not establish playability or solve memory pressure.
Checklist
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T21:39:31Z.
Checked on Linux merged onto current main: libSceAgcDriver build and ctest (390/390,
agc_driver_graphicspasses). The fix and its test are_WIN32-only; reviewed the code: the overlap check runs before the collect memo path and before the tracker lock, andWatched/UnchangedSince/UnchangedSinceAllnow reject the excluded ranges, matching the existing store path. The Windows run with the negative control in the description covers the runtime behaviour. Merging once CI is green.