Watch: a late lock-free fault no longer undoes the guard taken since #900

Closed
github-bot wants to merge 2 commits from github-bot/gh-900 into main AGit
Owner

@⁠Machad3x on GitHub · 2026-11-28 08:48 UTC · original
pr/fault-guard → main · +62 −9 · 3 files · 2 commits · closed without merging

Fixes #817.

A lock-free write fault that arrives late could undo a guard taken after it, so a later write went untracked and the next fault on that page was an access violation. The late fault now leaves alone any guard taken since it was raised.

  • 477d5c5e: the fix in the watch, with regression test a_late_fault_leaves_the_guard_taken_since.
  • 12f300c0: test-only fix. One test made a view at an address another test was still changing, and section numbers were reported gone before they were closed. This was a hang in cargo test, not in the game.

Testing:

  • cargo test -p victory-gpu: 454 passed, 0 failed (36 ignored), on top of 63b902fe.
  • In our fork this has been in every run since batch 9 (about 10 runs of 240 s on an RTX 3080 Ti, Ryzen 7 5700X) with no access violation from the watch.

First landed in our fork: github.com/Machad3x/VIctory-nvidia-RTX@3175c5dc and github.com/Machad3x/VIctory-nvidia-RTX@df65d657 (fork main since batch 9). Cherry-picked onto current main here.

🤖 Generated with Claude Code

**@⁠Machad3x** on GitHub · 2026-11-28 08:48 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/900) `pr/fault-guard` → `main` · +62 −9 · 3 files · 2 commits · closed without merging Fixes #817. A lock-free write fault that arrives late could undo a guard taken after it, so a later write went untracked and the next fault on that page was an access violation. The late fault now leaves alone any guard taken since it was raised. - `477d5c5e`: the fix in the watch, with regression test `a_late_fault_leaves_the_guard_taken_since`. - `12f300c0`: test-only fix. One test made a view at an address another test was still changing, and section numbers were reported gone before they were closed. This was a hang in `cargo test`, not in the game. Testing: - `cargo test -p victory-gpu`: 454 passed, 0 failed (36 ignored), on top of `63b902fe`. - In our fork this has been in every run since batch 9 (about 10 runs of 240 s on an RTX 3080 Ti, Ryzen 7 5700X) with no access violation from the watch. First landed in our fork: https://github.com/Machad3x/VIctory-nvidia-RTX/commit/3175c5dc and https://github.com/Machad3x/VIctory-nvidia-RTX/commit/df65d657 (fork main since batch 9). Cherry-picked onto current main here. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A write fault that checked PROTECTED, and reached open_unlocked only
after another fault had opened the block and that was settled, found
the block writable already but queued its opening anyway. A refresh
that had looked at the block before guarded it again (read-only,
protected, clean); the next settle then took the stale entry, removed
the block from the guards and cleared PROTECTED with the memory still
read-only. The title's next write there was an access violation no
handler took (seen as segfaults of the victory-gpu tests, in the land,
many-askers and refresh tests).

open_unlocked notes whether its VirtualProtect made the block
writable; settle leaves an entry that did not alone, but for its
OPENING and TOLD bits. Test a_late_fault_leaves_the_guard_taken_since.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 3175c5dc9eed2d1ec30fd2dc3a2a21a0b1879425)
Watch tests failed now and then in the full victory-gpu suite and
what_the_title_puts_in_beside_a_guard_is_told could spin forever.
Cause: two tests released a fresh-address view while holding
title_memory_remapping (the many-askers remap thread and
nothing_is_guarded_between_our_forgetting_it_and_its_unmapping). The
change still listed the block, so another test's view mapped at the
freed address meanwhile was left alone as changing: unguarded right
after its first guard, reported written, and put_beside said Cannot
for good. The runtime maps into placeholders of its own, so it is
not exposed; the tests now let go once the change is done.

drop_views tells title_memory_section_gone before CloseHandle, as
xmem.rs does; told after, a test given the same handle number lost
its view beside the guards. title_memory_section_gone also forgets
the section's size.

views_off_their_elements_get_a_copy_of_their_bytes failed when its
page lay a multiple of 456 bytes into its copy's window (about one
placement in 57): the view is on its elements then, as the code
rightly says. The test moves a page on in that case.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit df65d657ab62d19e8322face017257df0491b135)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:29:49 +00:00
github-bot closed this pull request 2026-11-29 02:06:41 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!900
No description provided.