GPU/watch: do not treat absent blocks as known views when reallocated as private memory #804
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!804
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-804"
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?
@AscilCH on GitHub · 2026-11-25 08:19 UTC · original
AscilCH:fix/gpu-watch-known-view-absent-private-memory→main· +68 −6 · 1 files · 1 commits · openSummary
Fix
watch::known_view()andwatch::guard()incrates/victory-gpu/src/watch.rsso uncommittedg.absentblocks are not treated as knownMEM_MAPPEDviews after private memory is allocated at the same virtual address:9376fd6addedknown_view(start)beforeGetWriteWatchand returnedtruefor bothg.protected.contains(&first)andg.absent.contains(&first).guard()likewise skippedis_view()wheneverg.absent.contains(&first).MEM_WRITE_WATCHor ordinaryMEM_PRIVATEmemory at a formerly uncommitted address (viaVirtualAlloc, which does not triggertitle_memory_remapped),writes()bypassedGetWriteWatch, enteredguard(), removed the block fromg.absent, and calledVirtualProtect(..., PAGE_READONLY)on the private allocation—breaking kernel writes (ReadFilefailing withERROR_NOACCESS) and causing access-violation faults on private write-watched buffers.g.protected.contains(&first)inknown_view()andguard(), and verifyis_view()before guarding any block transitioning out ofg.absent.watch::tests::absent_block_reallocated_as_private_memory_is_not_guardedtesting bothMEM_WRITE_WATCHand ordinaryMEM_PRIVATEreallocations at a formerlyabsentaddress.Verification
cargo test -p victory-gpu --locked -- watch:::13 passed; 0 failed; 0 ignored.cargo clippy -p victory-gpu --all-targets --all-features --locked: 0 warnings incrates/victory-gpu/src/watch.rs(only pre-existing9376fd6warnings indraw.rsandindirect.rs).cargo xtask policy:171 files ok.(AI-assisted; synthetic unit tests only, no game data.)
@MamaLeVrai on GitHub · 2026-11-25 09:54 UTC · original
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head
72d2313intomain9376fd6in a throwaway tree (no conflict).cargo clippy --workspace --all-targets --locked -- -D warningsfails, with the same two errors asmainitself on this machine (function placed_filler_twins is never used,field depth_written is never read,victory-gpu): this PR adds none and removes none.cargo test --workspace --locked: first run 541 passed, 0 failed, 10 ignored (mainalone: 540 passed). In the second run thevictory-gputest binary died withSTATUS_ACCESS_VIOLATION(0xc0000005) after 40 tests, so the run stopped there. I did not find which test it was, and I have not reproduced it since;mainalone did not crash in its two runs. The title was not run, so this says nothing about in-game effect. No game data.AI-assisted (Claude Code); no game data.
@MamaLeVrai on GitHub · 2026-11-25 10:09 UTC · original
Follow-up to my test report above: I could reproduce a failure on this PR's tree, and it is in a test of
watch.rs.What I saw (RX 6950 XT, Windows 11; this PR's head
72d2313merged intomain9376fd6): runningcargo test -p victory-gpu --librepeatedly on that tree, the testwatch::tests::written_pages_are_reported_to_every_askerfailed in 3 of 13 runs, withThe other runs passed (145 passed each).
mainalone, 12 runs of the same command: 0 failures. So the intermittent failure appears with this PR and not without it, on this machine. (TheSTATUS_ACCESS_VIOLATIONI reported earlier in one full run is a different symptom, and I did not catch which test it was.)I did not look for the cause. Since the PR changes how absent blocks are treated by the watch, the test's first assertion (nothing reported before the write) failing now and then looks like a page a previous test in the same process, or the PR's new handling, leaves marked; that is a guess, not a finding.
AI-assisted (Claude Code); no game data.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.