Retry in-flight faults after instruction patching #3599
No reviewers
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!3599
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3599"
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?
@slyd3 on GitHub · 2026-11-30 01:33 UTC · original
slyd3:fix-sse4a-patch-race→main· +47 −6 · 1 files · 1 commits · closed without mergingSummary
Evidence and limits
A gameplay crash reported an illegal instruction at a site whose original instruction was SSE4a, but whose crash-time bytes had already been replaced with a jump. The race is consistent with that evidence, but the game has not yet been retested with this change. Other memory, VRAM and Streamline warnings in those sessions are not addressed here.
Validation
cargo test -p victory-loader --lib(76 passed)cargo check -p victory-loader --features diagnosticsgit diff --checkcargo fmt -p victory-loader -- --checkreports extensive existing formatting differences across the package.@babuakhil on GitHub · 2026-11-30 18:45 UTC · original
Three open PRs fix the same race in
console_insn::emulate: this one, #4194 and #4196. Thread Y faults on a console instruction, thread X's handler replaces it, and Y's handler then reads the replacement, decodes nothing, and returns 0, the unhandled0xc000001dthat #4196 logged at sites startinge9. I compared all three on Windows 11 (Rust 1.98.1, pinned), each applied on currentmain(e1251c31); all three cherry-pick cleanly.cargo test -p victory-loader --libpasses on each (75 onmain, 76 with #4194 or this PR, which add a test), and Clippy onvictory-loaderis clean with-D warningson all three. Not tested in the game.What each one covers. The module replaces four kinds of instruction, and not all of them with a jump: SSE4a and
clzeroloops become ajmpto a stub, whilemonitorxandmwaitxare overwritten in place (0f 1f 00,f3 90 90). A throwaway test (not part of these PRs) ranemulatefor thread X on each kind, which replaces it, thenemulatefor a thread Y whose context still points there:maininsertq(jump to a stub)clzeroloop (jump to a stub)monitorx(replaced in place)mwaitx(replaced in place)#4196's
is_our_jumponly recognises a jump intoSTUBS, so the wait instructions, which spin loops sit on and where many threads meet the same site at once, still crash with it. #4194 and this PR record every replacementpatchinstalls, so they cover all four. (#4194 retries once per thread and address, and a second immediate fault at the same place returns 0, a guard against looping. This PR retries whenever the bytes are still ours.)Cost. #4194 and this PR take
PATCHINGon every emulated instruction. Emulating aninsertqthat can't be replaced (it crosses its 16 bytes), release build, best of three:mainThe extra lock is lost in what the path already costs under contention on
main, and a real fault costs microseconds beforeemulateruns, so I don't think speed decides it.So I'd take this PR or #4194, which behave the same here, and not #4196 alone. #4196's crash logs and its Intel reproduction are the best evidence for the race, and they apply equally to the other two.
@trustno1-coder on GitHub · 2026-12-01 18:50 UTC · original
Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.
Pull request closed