Intel: 0xc000001d when two threads reach an SSE4a instruction while it's being replaced (#1653) #2393

Closed
opened 2026-11-29 12:43:48 +00:00 by github-bot · 3 comments
Owner

@⁠iBooM72 on GitHub · 2026-11-29 12:39 UTC · original

What happened

v2026.11.29.01 crashed once, 2 min 45 s after the start, with 0xc000001d at victory-image-b99f876b74d4a77f.dll+0x55b1811. It happened on the first start of this release, with default VICTORY_PATCH_SSE4A (on).

Bytes at that address
Game file f2 0f 78 c9 08 18 (insertq xmm1, xmm1, 8, 24)
Crash log e9 8a ea 9c fa 90 (the jump from #1653 and a NOP)

Likely cause (from the code and tests): two threads fault on the same instruction, and the first one replaces it. When the second thread's fault is handled, emulate() reads the new bytes, can't decode the jump and returns 0. The fault then ends the run. This depends on timing, so it won't happen on every start.

Tests on the unfixed release code (the tests aren't in the repo):

  • 8 threads running real insertq at 128 places ended with 0xc000001d in 10 of 10 runs.
  • A late fault passed straight to the handler was not handled for any of the six replacements tested: insertq, extrq, monitorx, mwaitx, the clzero loop and clwb. So the same gap affects the older replacements too. I only saw the SSE4a one crash in the game.

Workaround: start with --set VICTORY_PATCH_SSE4A=0, or add VICTORY_PATCH_SSE4A=0 to victory-settings.txt. I haven't seen 0xc000001d since, including in a 30-minute run. The crash depends on timing, so that isn't proof. It doesn't change the older replacements.

About a fix: I tried running the replacement again when a late fault hits its exact bytes. That isn't safe enough for a PR yet:

  • Handling only late 0xc000001d faults: 19 of 1,500 debug runs of the 8-thread test ended with 0xc0000096.
  • Handling late 0xc0000096 faults too: 2 of 8,000 runs (debug and release) still ended with 0xc0000005. The cause isn't known. Changing code that other cores may be running needs synchronization, and one atomic write isn't enough.

Safer options may be to turn VICTORY_PATCH_SSE4A off by default for now, or to replace known instructions before any title thread starts. Neither has been tested. I can share the tests. Which approach would you prefer?

GPU and driver

RTX 4070 Ti 12 GB, driver 621.01

CPU, RAM and Windows version

Intel Core i7-14700K, 32 GB, Windows 11 build 26300

VIctory release or commit

v2026.11.29.01 (official release)

Settings

Series X, 1080to1440, DLSS Quality, frame generation off, ray tracing off, 120 FPS cap.

Logs

Attached (redacted): the play log and this crash's entry from crashes.log. The memory dump isn't attached.

Are you working on a fix?

I'd like to, with some pointers


Investigated and written with an AI assistant (Claude Code); the crash and tests were on my PC.

sse4a-crash-logs.zip

**@⁠iBooM72** on GitHub · 2026-11-29 12:39 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2393) ### What happened v2026.11.29.01 crashed once, 2 min 45 s after the start, with `0xc000001d` at `victory-image-b99f876b74d4a77f.dll+0x55b1811`. It happened on the first start of this release, with default `VICTORY_PATCH_SSE4A` (on). | | Bytes at that address | |---|---| | Game file | `f2 0f 78 c9 08 18` (`insertq xmm1, xmm1, 8, 24`) | | Crash log | `e9 8a ea 9c fa 90` (the jump from #1653 and a NOP) | **Likely cause (from the code and tests):** two threads fault on the same instruction, and the first one replaces it. When the second thread's fault is handled, `emulate()` reads the new bytes, can't decode the jump and returns 0. The fault then ends the run. This depends on timing, so it won't happen on every start. **Tests on the unfixed release code (the tests aren't in the repo):** - 8 threads running real `insertq` at 128 places ended with `0xc000001d` in **10 of 10** runs. - A late fault passed straight to the handler was not handled for any of the six replacements tested: `insertq`, `extrq`, `monitorx`, `mwaitx`, the `clzero` loop and `clwb`. So the same gap affects the older replacements too. I only saw the SSE4a one crash in the game. **Workaround:** start with `--set VICTORY_PATCH_SSE4A=0`, or add `VICTORY_PATCH_SSE4A=0` to `victory-settings.txt`. I haven't seen `0xc000001d` since, including in a 30-minute run. The crash depends on timing, so that isn't proof. It doesn't change the older replacements. **About a fix:** I tried running the replacement again when a late fault hits its exact bytes. That isn't safe enough for a PR yet: - Handling only late `0xc000001d` faults: 19 of 1,500 debug runs of the 8-thread test ended with `0xc0000096`. - Handling late `0xc0000096` faults too: 2 of 8,000 runs (debug and release) still ended with `0xc0000005`. The cause isn't known. Changing code that other cores may be running needs synchronization, and one atomic write isn't enough. Safer options may be to turn `VICTORY_PATCH_SSE4A` off by default for now, or to replace known instructions before any title thread starts. Neither has been tested. I can share the tests. Which approach would you prefer? ### GPU and driver RTX 4070 Ti 12 GB, driver 621.01 ### CPU, RAM and Windows version Intel Core i7-14700K, 32 GB, Windows 11 build 26300 ### VIctory release or commit v2026.11.29.01 (official release) ### Settings Series X, `1080to1440`, DLSS Quality, frame generation off, ray tracing off, 120 FPS cap. ### Logs Attached (redacted): the play log and this crash's entry from `crashes.log`. The memory dump isn't attached. ### Are you working on a fix? I'd like to, with some pointers --- Investigated and written with an AI assistant (Claude Code); the crash and tests were on my PC. [sse4a-crash-logs.zip](https://github.com/user-attachments/files/35571416/sse4a-crash-logs.zip)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 12:43:48 +00:00
Author
Owner

@⁠KWillTech on GitHub · 2026-11-29 15:39 UTC · original

Same crash here, on a different Intel CPU and a different insertq.

Build built from source at v2026.11.29.01 (829188e), release
CPU Intel Core i5-14450HX (no SSE4a)
GPU RTX 5060 Laptop GPU 8 GB, driver 621.14
RAM / OS 16 GB, Windows 11 (10.0.26300)
Profile Series S, DLSS Balanced, frame generation 2x

0xc000001d at victory-image-b99f876b74d4a77f.dll+0x5084782, about 7 minutes after the start, in the world. Windows Error Reporting names the module and the offset; there was no crash log from the layer.

Bytes at that address
Game file f2 0f 78 c0 08 18 (insertq xmm0, xmm0, 8, 24)

The log's only "a console CPU instruction this CPU lacks: emulated" line is for another insertq (len: 16, idx: 16), so this site was replaced during the run, and a second thread most likely faulted on it while it was being replaced, as described above.

I applied the same idea as #2614 locally (sites we replace are recorded; a fault at one of them that no longer decodes returns CONTINUE_EXECUTION without moving rip), with a unit test that emulates the first fault and then a late one at the same rip. The test fails without the change and passes with it. With the change, the next run stayed in the world for over 9 minutes without this crash. That is a single run, so it is not proof, but it is consistent with the cause in this issue.

+1 for merging #2614 or #2585.

**@⁠KWillTech** on GitHub · 2026-11-29 15:39 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2393#issuecomment-7258268462) Same crash here, on a different Intel CPU and a different `insertq`. | | | |---|---| | Build | built from source at `v2026.11.29.01` (829188e), release | | CPU | Intel Core i5-14450HX (no SSE4a) | | GPU | RTX 5060 Laptop GPU 8 GB, driver 621.14 | | RAM / OS | 16 GB, Windows 11 (10.0.26300) | | Profile | Series S, DLSS Balanced, frame generation 2x | `0xc000001d` at `victory-image-b99f876b74d4a77f.dll+0x5084782`, about 7 minutes after the start, in the world. Windows Error Reporting names the module and the offset; there was no crash log from the layer. | | Bytes at that address | |---|---| | Game file | `f2 0f 78 c0 08 18` (`insertq xmm0, xmm0, 8, 24`) | The log's only "a console CPU instruction this CPU lacks: emulated" line is for another `insertq` (`len: 16, idx: 16`), so this site was replaced during the run, and a second thread most likely faulted on it while it was being replaced, as described above. I applied the same idea as #2614 locally (sites we replace are recorded; a fault at one of them that no longer decodes returns `CONTINUE_EXECUTION` without moving `rip`), with a unit test that emulates the first fault and then a late one at the same `rip`. The test fails without the change and passes with it. With the change, the next run stayed in the world for over 9 minutes without this crash. That is a single run, so it is not proof, but it is consistent with the cause in this issue. +1 for merging #2614 or #2585.
Author
Owner

@⁠iBooM72 on GitHub · 2026-11-29 18:05 UTC · original

I stress-tested #2614 (eae2afbb) and #2585 (87ddb293) on Windows. Neither fixes every crash in this test, but #2585 is much better. Only VICTORY_PATCH_SSE4A=0 passed every run.

Test: 8 threads reach the same insertq together, at 128 places per run. It uses the loader's real exception handler, and each run is a separate process. The PRs' console_insn.rs files are unchanged apart from line endings. The base (829188e9) and the added test are the same for all versions. i7-14700K, Windows 11, half debug runs and half release. This is much harsher than the game, so these aren't in-game crash rates. I didn't run the game.

Version Runs Passed 0xc000001d 0xc0000096 0xc0000005
829188e9 200 0 200 0 0
#2614 2,000 13 1,981 6 0
#2585 20,000 19,747 (98.7%) 0 250 3
829188e9, VICTORY_PATCH_SSE4A=0 20,000 20,000 (100%) 0 0 0

#2614: it notes a place only after changing its bytes, so a late fault in between isn't recognised. To check this, I moved that step before the change in a local copy. 0xc000001d went from 1,981 in 2,000 runs to 0. That isn't a safe fix, though: 468 of those 2,000 runs finished but failed the test's final checks. All 55 outputs I saved from them report wrong insertq results (the other 29 failures were 0xc0000096). I haven't confirmed why. The handler still reads the code without a lock while another thread may be changing it, so it may have decoded a mix of old and new bytes. #2585 reads the bytes under the patch lock and had no wrong results in its 19,747 completed runs.

#2585: 0xc000001d is gone here, which matches the Proton result in its comments. Neither PR handles late 0xc0000096 faults. All three 0xc0000005 crashes were at replaced places, in debug runs. One was at byte 4 of the 6-byte instruction. Neither the old instruction nor the new jmp + nop has an instruction starting there, which would fit a core running a mix of old and new bytes. That isn't proof, but it's why I wouldn't just retry 0xc0000005 faults.

My own unfinished fix also handles late 0xc0000096 faults, and it still had 2 0xc0000005 crashes in 8,000 runs of a similar test. So handling late faults may not be enough while code that other cores may be running is being changed.

Replacement off: with VICTORY_PATCH_SSE4A=0, the same test programs that crashed in all 200 runs of 829188e9 passed all 20,000. Every result was right and nothing was replaced, so the crashes in this test come from the replacement. It only covers insertq, and this switch doesn't affect the clzero, monitorx/mwaitx or clwb replacements. With the switch off, a CPU without SSE4a raises an exception each time one of these instructions runs. The comment on patches_sse4a mentions one insertq that faulted about 3,700 times a second. I didn't measure what that costs in the game.

#2585 looks like the better of the two PRs, but not a complete fix. From these results, turning VICTORY_PATCH_SSE4A off by default looks like the safest option for now, if the cost in the game is acceptable. I can share the test and the saved output.

Tests and this comment were prepared with an AI assistant (Claude Code).

**@⁠iBooM72** on GitHub · 2026-11-29 18:05 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2393#issuecomment-7260204457) I stress-tested #2614 (`eae2afbb`) and #2585 (`87ddb293`) on Windows. **Neither fixes every crash in this test, but #2585 is much better. Only `VICTORY_PATCH_SSE4A=0` passed every run.** **Test:** 8 threads reach the same `insertq` together, at 128 places per run. It uses the loader's real exception handler, and each run is a separate process. The PRs' `console_insn.rs` files are unchanged apart from line endings. The base (`829188e9`) and the added test are the same for all versions. i7-14700K, Windows 11, half debug runs and half release. This is much harsher than the game, so these aren't in-game crash rates. I didn't run the game. | Version | Runs | Passed | `0xc000001d` | `0xc0000096` | `0xc0000005` | |---|---|---|---|---|---| | `829188e9` | 200 | 0 | 200 | 0 | 0 | | #2614 | 2,000 | 13 | 1,981 | 6 | 0 | | #2585 | 20,000 | 19,747 (98.7%) | **0** | 250 | 3 | | `829188e9`, `VICTORY_PATCH_SSE4A=0` | 20,000 | **20,000 (100%)** | 0 | 0 | 0 | **#2614:** it notes a place only after changing its bytes, so a late fault in between isn't recognised. To check this, I moved that step before the change in a local copy. `0xc000001d` went from 1,981 in 2,000 runs to 0. **That isn't a safe fix, though:** 468 of those 2,000 runs finished but failed the test's final checks. All 55 outputs I saved from them report wrong `insertq` results (the other 29 failures were `0xc0000096`). I haven't confirmed why. The handler still reads the code without a lock while another thread may be changing it, so it may have decoded a mix of old and new bytes. #2585 reads the bytes under the patch lock and had no wrong results in its 19,747 completed runs. **#2585:** `0xc000001d` is gone here, which matches the Proton result in its comments. Neither PR handles late `0xc0000096` faults. All three `0xc0000005` crashes were at replaced places, in debug runs. One was at byte 4 of the 6-byte instruction. Neither the old instruction nor the new `jmp` + `nop` has an instruction starting there, which would fit a core running a mix of old and new bytes. That isn't proof, but it's why I wouldn't just retry `0xc0000005` faults. My own unfinished fix also handles late `0xc0000096` faults, and it still had 2 `0xc0000005` crashes in 8,000 runs of a similar test. So handling late faults may not be enough while code that other cores may be running is being changed. **Replacement off:** with `VICTORY_PATCH_SSE4A=0`, the same test programs that crashed in all 200 runs of `829188e9` passed all 20,000. Every result was right and nothing was replaced, so the crashes in this test come from the replacement. It only covers `insertq`, and this switch doesn't affect the `clzero`, `monitorx`/`mwaitx` or `clwb` replacements. With the switch off, a CPU without SSE4a raises an exception each time one of these instructions runs. The comment on `patches_sse4a` mentions one `insertq` that faulted about 3,700 times a second. I didn't measure what that costs in the game. #2585 looks like the better of the two PRs, but not a complete fix. From these results, turning `VICTORY_PATCH_SSE4A` off by default looks like the safest option for now, if the cost in the game is acceptable. I can share the test and the saved output. *Tests and this comment were prepared with an AI assistant (Claude Code).*
Author
Owner

@⁠diademoff on GitHub · 2026-11-30 10:40 UTC · original

Two more instances of the same shape on v2026.11.29.05, Linux/Proton (RTX 3060 12 GB, i7-12700, GE-Proton11-15 and Proton Experimental): +0x5084782 twice (e9 b9 ba 1f fa 90 … and e9 b9 ba 8f fa 90 …) and +0x27c8f2 once (e9 a9 39 a0 ff 90 90 …), all right after the loading art while pixel shaders are translated. Full data, logs and what was ruled out are in #3775.

**@⁠diademoff** on GitHub · 2026-11-30 10:40 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/2393#issuecomment-7275919720) Two more instances of the same shape on v2026.11.29.05, Linux/Proton (RTX 3060 12 GB, i7-12700, GE-Proton11-15 and Proton Experimental): `+0x5084782` twice (`e9 b9 ba 1f fa 90 …` and `e9 b9 ba 8f fa 90 …`) and `+0x27c8f2` once (`e9 a9 39 a0 ff 90 90 …`), all right after the loading art while pixel shaders are translated. Full data, logs and what was ruled out are in #3775.
This discussion has been locked. Commenting is limited to contributors.
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#2393
No description provided.