watch: a late lock-free write fault can undo a guard taken since (access violation) #817
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA#817
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@Machad3x on GitHub · 2026-11-28 06:52 UTC · original
Summary: a race in the lock-free write-fault path of
crates/victory-gpu/src/watch.rs(fromf5bde6b5, on by default). It can leave a guarded block read-only with itsPROTECTEDbit cleared. The title's next write to that block is then an access violation that no handler takes.Sequence:
PROTECTED, opens the block, and the opening is settled.PROTECTEDbefore A's opening was settled. It reachesopen_unlockedonly after that, finds the block already writable, and still queues its own opening.PROTECTED, but the memory stays read-only.Where we saw it: segfaults in the victory-gpu unit tests (the land, many-askers and refresh tests), about 1 run in 7 on tn1 main 3c142d49. In the game this would show as a crash on a title write. On tn1 main this also caused a test hang, in
what_the_title_puts_in_beside_a_guard_is_toldlooping onput_besidereturningCannot. That hang is a separate, test-only bug: two tests released a view while still holding the mapping-change lock.Fix on our side:
open_unlockedrecords whether its ownVirtualProtectmade the block writable.settleleaves an entry that did not make it writable alone, apart from itsOPENINGandTOLDbits. Regression test:a_late_fault_leaves_the_guard_taken_since. After the fix we ran the tests 80 times on tn1 main and 40 times on our batch, with no segfaults. I will link the commit once it is pushed to our fork (Machad3x/VIctory-nvidia-RTX).Setup: RTX 3080 Ti, driver 621.40, Windows 11 Pro build 26300, Ryzen 7 5700X,
cargo test -p victory-gpu --profile diag --lib.@github-actions[bot] on GitHub · 2026-11-28 06:53 UTC · original
Please attach both logs from the run that went wrong. Without them we can only guess. Paste
%LOCALAPPDATA%into the address bar of File Explorer to get there.%LOCALAPPDATA%\victory\logs\: the newestvictory-nvidia-play-<date>-<time>-<number>.log(fromvictory.exe) orvictory-nvidia-<date>-<time>.log(from the script launcher). The window shows its path at the start, on the lineLog: ....%LOCALAPPDATA%\VIctory\data\7952987A\crashes.log, and, if there is one from that run, the newestvictory-<date>-<time>-<number>.crash.login%LOCALAPPDATA%\VIctory\data\7952987A\temp\.Also say which GPU, Windows version (10 or 11)
@Machad3x on GitHub · 2026-11-28 07:09 UTC · original
Fix pushed to our fork:
github.com/Machad3x/VIctory-nvidia-RTX@3175c5dc(regression testa_late_fault_leaves_the_guard_taken_since). The test-only hang fix isgithub.com/Machad3x/VIctory-nvidia-RTX@df65d657.github-bot referenced this issue2026-11-28 14:28:34 +00:00
@yeedgrthfgv on GitHub · 2026-11-28 08:07 UTC · original
Thanks for finding this and for the fix. I would like to send a pull request that makes VICTORY_FAULT_UNLOCKED easy to try: your race fix (3175c5dc) and your test fixes (df65d657) cherry picked with you kept as the author, plus an F1 menu line for the switch, still off by default.
I tested it on a Ryzen 5 9600X with an RTX 5080: no crash with the switch on, and the wait for the guards lock went from about 45 ms to about 10 ms a frame across all threads. The frame rate did not change on my PC.
Is that OK with you, or would you rather send your fix yourself? If you send it, I will only add the menu line and my numbers on top.