Loader: a fault on an SSE4a site another thread just replaced runs again as the jump #4196
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!4196
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4195"
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?
@transbinaryunicorn-sys on GitHub · 2026-11-30 17:19 UTC · original
transbinaryunicorn-sys:fix-sse4a-race→main· +24 −1 · 1 files · 1 commits · closed without mergingFixes the
0xc000001dcrash at an already-patched SSE4a site reported in #1428.The race
Two threads that fault on the same
insertq/extrqboth enterconsole_insn::emulate(). The first handler replaces the instruction with ajmpto its stub (patch_sse4a→patch(), atomic viacmpxchg16b, andpatch()already handles "another thread's fault at the same place"). But if the second handler reads the bytes atriponly after that,decode()finds thejmp, sees no console-only instruction, andemulate()returns 0, so it never gets topatch(). The exception goes unhandled, at a site whose code startse9:The fix
When
decode()finds nothing, check whether the bytes atripare ajmp rel32into one of ourSTUBSregions (is_our_jump). If so, another thread just replaced the instruction: returnCONTINUE_EXECUTIONwithout movingrip, so the thread runs the jump into the stub. Any other unknown instruction still returns 0 as before, so real illegal instructions and the other vectored handlers are unaffected. The path logs once.Tested
Xeon w7-3465X (28C/56T, Intel, no SSE4a), RTX 5090, Linux (Wine), Series X image:
VICTORY_PATCH_SSE4A+0x27c8f2,+0x5084782)=0a console CPU instruction another thread replaced meanwhile: run again as the jump ... at=0x...4782, the same site as the second crash aboveBuilds clean on top of current main. Only
crates/victory-loader/src/console_insn.rschanges (+24/−1).Many cores without SSE4a (Intel, many threads hitting the same
insertqat once when the prologue loads) make this likely; on 6–8 core machines it is probably rare, which may be why it hasn't shown up before.🤖 Generated with Claude Code
https://claude.ai/code/session_01HTKMrPY51kbJiQAEkckA8e
@trustno1-coder on GitHub · 2026-12-01 18:45 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