Repository navigation
fix(memory): exclude arena host holes from every write-tracking query - #4186
oneandonlydean merged 3 commits into
Conversation
On Windows agc_write_tracking has failed since boykopovar#3594 with write tracking test failed: an unwatched range reads as not stored over from the check in CheckSharedBlock: if (!Watched(outside, unwatched.size())) Require(StoredOver(outside, unwatched.size(), TrackerGeneration()), "an unwatched range reads as not stored over"); The host stack array lies in a host hole of the guest arena. boykopovar#3594 made Watched, collectWrites, UnchangedSince, UnchangedSinceAll and storeOwn reject ranges overlapping such holes, but StoredOver, MarkWritten, WrittenSince, ChangedBlocks and ImportWatched still accepted them through WriteTracker::covers(), so StoredOver proved a range not stored over while Watched called it unwatched (boykopovar#4087). The exclusion now lives in WriteTracker::covers() on Windows, which every query already asks, and the per-function checks are removed. Host holes are padded to the allocation granularity and the tracker blocks are 64 KiB from the arena base, so no block is shared between a hole and arena memory, and ranges outside the holes get the same answers as before. A new case enumerates the arena for a host hole and checks every query against it; on the previous code StoredOver, MarkWritten, StoreOwnBytes, WrittenSince and ChangedBlocks fail it. Fixes boykopovar#4087 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
This does what the title says for four of the five migrated call sites — There's a real gap in the fifth: The new Everything here is Windows-only by construction — the non-Windows branch of Written with AI assistance. |
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
|
Carry-review update: head b45232d preserves the original author commit and adds a fixture-only correction. Windows ASLR can leave every host allocation outside the guest-arena interval; I reproduced that in a separate 007-stack test launch. With no hole, the fixture now explicitly reports only the host-hole subcase skipped and continues the other write-tracking checks. Current-main test integration 162daec, three fresh |
|
@Dextroid17 Thanks for checking the early-return path. I am reviewing this separately from the 007 performance run. In the current code a thread memo entry is inserted only after I agree the fixture should exercise repeated queries with a warm valid-range memo, not only cold hole queries. I will add that coverage before treating this review as resolved. If you have a concrete sequence that seeds a memo over a host hole through public APIs, please share it; I want to reproduce it rather than assume the invariant holds. No production-code change or claim of a reproduced memo bypass yet. AI-assisted: yes (Codex). |
|
Warm-memo coverage is now in 29a8435. With an actual host hole, the fixture allocates a watched range, warms and repeatedly queries it within each of two explicit collect epochs, and interleaves repeated full-range and sub-page host-hole queries. Those queries must return0 while the watched range stays collectable. This does not fabricate a memo entry over a host hole or claim a reproduced bypass. On the current-main host-hole integration, three fresh Windows AI-assisted: yes (Codex). |
|
Test note (Windows 10, GCC Release, libs only, no other tests run): merge of this PR onto current main (
Result: neutral for Sifu (the fault is the same on plain main, so it is not caused by this PR). DREDGE: one fatal in five runs with the PR, none without; 0/5 vs 1/5 is not significant (Fisher p = 1.0), and DREDGE is known to fault intermittently in the write-watch path, so I cannot attribute it to this PR or rule it out. I did not check whether the faulting address lies in a host hole, and I did not run the AI-assisted (Claude Code). |
|
Thanks for the alternating comparison and for separating the shared Sifu fault from the DREDGE observation. I will keep the DREDGE result recorded as unresolved; the small sample does not establish a regression or rule one out. Our Windows write-tracking fixture runs passed with actual host holes, including valid-range memo warming and queries across collect epochs, but those checks do not explain the intermittent title fault. If a future failing run gives a fault address relative to the arena/host-hole ranges or a short tracker-only stack, that would help narrow a concrete reproduction without sharing title code. No need to upload the title or shader captures. The production patch remains the original author's host-hole exclusions; I have not changed it in response to this result. AI-assisted: Codex. |
|
Additional Windows cross-test note: the current hostWriteWatchExclusionTests fixture can fail before any exclusion query checks with "write-watched arena contained no host exclusion to test". This occurred once in the 007 sparse-mirror test stack; repeating the same graphics executable passed. The fixture currently assumes a host exclusion exists inside the reserved arena, which appears sensitive to process layout. This is an observed fixture failure, not evidence that an excluded host region passed a write-watch proof. I will keep it separate from the unresolved alternating DREDGE fault report and make fixture setup explicit before treating it as reliable coverage. AI-assisted: Codex. |
What
Windows host holes inside the reserved guest-arena interval must be unwatched for every write-tracking query. Move the exclusion into
WriteTracker::covers()soMarkWritten,StoreOwnBytes,WrittenSince,ChangedBlocksand the other stamp readers agree, and remove the duplicated checks. A twelve-query Windows fixture checks an actual host hole discovered withVirtualQuery.Carries screamm's
03860b02unchanged in content and preserving authorship, as explicitly offered in #4087. Based on main7a84b222, including #4131'sStoredOverfix; this covers the remaining queries. Original branch: https://github.com/screamm/AnyPS5/tree/fix/write-tracking-host-holes. Relates to #4087 and #3594.Tested
Windows 11 Pro 26200, GCC 15.2 Release, RTX 5070 Ti, required Vulkan. Current-main integration
27c134117e5aa548252123d3cbb66cda0af5b82bcombines this exact commit with a separate CPU-copy profiling-only change:agc_write_tracking,agc_write_watch_coverage,guest_memory,agc_driver_graphics,agc_driver_bda_devicepassed 5/5 in 8.53 seconds. No Linux or full-suite claim. Updated carry headb45232dda67ccea86b19f5b7a24a1b0944a01f72passes conventions and diff checks. The fixture now prints an explicit subcase skip when Windows ASLR leaves no host allocation inside the guest arena, instead of failing the whole test. Other checks still run. On current-main integration162daec28a730068a210268738b61f32bec05e1f, three fresh write-tracking runs passed (0.08/0.04/0.04 seconds), all with actual host-hole coverage and no skip message. A separate rendering-stack run exercised the no-hole skip and passed the other checks. The original author commit is retained unchanged; the fixture correction is a separate carry-review commit.Checklist
main; no other open PR implements the same functions