Title crashes on CPUs without CLWB support (STATUS_ILLEGAL_INSTRUCTION 0xc000001d) #108

Open
opened 2026-11-26 03:50:27 +00:00 by github-bot · 4 comments
Owner

@⁠lucastol3do on GitHub · 2026-11-24 00:35 UTC · original

Summary

The title boots, loads all archives, creates the D3D12 device, opens the window, and then crashes within ~2 seconds with STATUS_ILLEGAL_INSTRUCTION (0xc000001d). The faulting instruction is clwb (Cache Line Write Back), which the host CPU does not support. The README lists "a CPU with AVX2" as the only CPU requirement, but the title's own code uses clwb, which is not present on all AVX2-capable CPUs (notably Intel Broadwell and earlier).

Environment

CPU 2× Intel Xeon E5-2680 v4 (Broadwell-EP, 2016) — has AVX2, no CLWB
GPU (D3D12, shader model 6.6 capable)
OS Windows 11
VIctory build b99f876b74d4a77f (release and diag, --features diagnostics)
Title Xbox Series X title, TitleID 7952987A, version 1.0.2.1
Console mode series-x (default)
Tested with VICTORY_D3D12_WARP=1 (software adapter) — same crash, confirming it is CPU-side, not GPU-side

What happens

The loader maps the image, binds all imports (game_scarlett_master.exe: 88 hle, 427 host, 72 title, 0 missing), redirects static TLS (index 12, 53246 patches), opens every .rpf archive, creates the host D3D12 device, fits the window, and enters the title's first frames. Then:

VIctory: first-chance exception 0xc000001d at victory-image-b99f876b74d4a77f.dll+0x4ecc84a
VIctory: unhandled exception 0xc000001d at victory-image-b99f876b74d4a77f.dll+0x4ecc84a

The faulting instruction

Disassembly of the in-memory image at RVA 0x4ecc84a (dumped via VICTORY_CRASH_SAVE=0x4ecc84a:256):

0x4ecc84a:  66 41 0f ae 31      clwb   byte ptr [r9]      ; <-- #UD here
0x4ecc84f:  49 83 c1 40         add    r9, 0x40           ; +64 (cache line size)
0x4ecc853:  49 39 c1            cmp    r9, rax
0x4ecc856:  76 f2               jbe    0x4ecc84a          ; loop
0x4ecc858:  48 83 c4 28         add    rsp, 0x28
0x4ecc85c:  c3                  ret

This is a cache-line write-back loop, present in the title's own code (confirmed at file offset 0x4ecbc4a in the prepared image, which is the same RVA after section alignment). It is not a VIctory-injected patch — the VIctory runs the title's x86-64 code natively, and the title was compiled for the Xbox Series X's AMD Zen 2, which supports clwb.

clwb (66 0f ae /6) was introduced in:

  • AMD: Zen 2 (2019)
  • Intel: Skylake-X / Ice Lake (client: 10th-gen Ice Lake, 2019; server: Cascade Lake-SP, 2019)

It is not present on:

  • Intel Broadwell (5th-gen, 2015) and earlier — including Xeon E5-26xx v4
  • AMD Zen 1 / Zen+ (Ryzen 1000/2000)

These CPUs do have AVX2, satisfying the stated requirement, but cannot execute clwb.

Call stack

#0  victory-image-b99f876b74d4a77f.dll+0x4ecc84a   ; clwb loop
#1  victory-image-b99f876b74d4a77f.dll+0x247905f
#2  victory-image-b99f876b74d4a77f.dll+0x19f4f54
#3  victory-image-b99f876b74d4a77f.dll+0x580437e
#4  victory-image-b99f876b74d4a77f.dll+0x43a4911
#5  victory-image-b99f876b74d4a77f.dll+0x224070b
#6  victory-image-b99f876b74d4a77f.dll+0x23cf00a
#7  victory-image-b99f876b74d4a77f.dll+0x2215eca
#8  KERNEL32.DLL+0x2dda7
#9  ntdll.dll+0x7ee4c

Registers at the fault (from the diag build):

rax 0x17bc001f  rcx 0x17bc0000  r9 0x17bc0000  rsp 0x8d3dfff3e0

r9 points into the title's mapped memory; rax is r9 + 0x1f (end of a 32-byte region, though the loop strides by 0x40).

Suggestion

Could VIctory detect clwb support at startup (CPUID leaf 7, sub-leaf 0, EDX[6]) and, when absent, trap #UD on clwb and fall back to clflush (or clflushopt if available, else clflush) on the same address? clwb and clflush/clflushopt take the same m8 operand, so the emulation is a straight substitution of the opcode bytes. This would let the title run on all AVX2 CPUs, matching the README's stated requirement.

Alternatively, the README's CPU requirement could be updated to "AVX2 and CLWB" to set expectations, though emulation seems preferable since the title presumably only needs the write-back effect, not clwb specifically.

Reproduction

cargo build --profile diag -p victory --features diagnostics
set VICTORY_CRASH_SAVE=0x4ecc84a:256
target\diag\victory.exe run <game dir>\game_scarlett_master.exe --execute

Attachments

**@⁠lucastol3do** on GitHub · 2026-11-24 00:35 UTC · [original](https://github.com/Marvisak/VIctory/issues/108) ## Summary The title boots, loads all archives, creates the D3D12 device, opens the window, and then crashes within ~2 seconds with `STATUS_ILLEGAL_INSTRUCTION` (`0xc000001d`). The faulting instruction is `clwb` (Cache Line Write Back), which the host CPU does not support. The README lists "a CPU with AVX2" as the only CPU requirement, but the title's own code uses `clwb`, which is not present on all AVX2-capable CPUs (notably Intel Broadwell and earlier). ## Environment | | | |---|---| | **CPU** | 2× Intel Xeon E5-2680 v4 (Broadwell-EP, 2016) — has AVX2, **no CLWB** | | **GPU** | (D3D12, shader model 6.6 capable) | | **OS** | Windows 11 | | **VIctory build** | `b99f876b74d4a77f` (release and diag, `--features diagnostics`) | | **Title** | Xbox Series X title, TitleID `7952987A`, version `1.0.2.1` | | **Console mode** | `series-x` (default) | | **Tested with** | `VICTORY_D3D12_WARP=1` (software adapter) — same crash, confirming it is CPU-side, not GPU-side | ## What happens The loader maps the image, binds all imports (`game_scarlett_master.exe: 88 hle, 427 host, 72 title, 0 missing`), redirects static TLS (index 12, 53246 patches), opens every `.rpf` archive, creates the host D3D12 device, fits the window, and enters the title's first frames. Then: ``` VIctory: first-chance exception 0xc000001d at victory-image-b99f876b74d4a77f.dll+0x4ecc84a VIctory: unhandled exception 0xc000001d at victory-image-b99f876b74d4a77f.dll+0x4ecc84a ``` ## The faulting instruction Disassembly of the in-memory image at RVA `0x4ecc84a` (dumped via `VICTORY_CRASH_SAVE=0x4ecc84a:256`): ```asm 0x4ecc84a: 66 41 0f ae 31 clwb byte ptr [r9] ; <-- #UD here 0x4ecc84f: 49 83 c1 40 add r9, 0x40 ; +64 (cache line size) 0x4ecc853: 49 39 c1 cmp r9, rax 0x4ecc856: 76 f2 jbe 0x4ecc84a ; loop 0x4ecc858: 48 83 c4 28 add rsp, 0x28 0x4ecc85c: c3 ret ``` This is a cache-line write-back loop, present in the **title's own code** (confirmed at file offset `0x4ecbc4a` in the prepared image, which is the same RVA after section alignment). It is not a VIctory-injected patch — the VIctory runs the title's x86-64 code natively, and the title was compiled for the Xbox Series X's AMD Zen 2, which supports `clwb`. `clwb` (`66 0f ae /6`) was introduced in: - **AMD**: Zen 2 (2019) - **Intel**: Skylake-X / Ice Lake (client: 10th-gen Ice Lake, 2019; server: Cascade Lake-SP, 2019) It is **not** present on: - Intel Broadwell (5th-gen, 2015) and earlier — including Xeon E5-26xx v4 - AMD Zen 1 / Zen+ (Ryzen 1000/2000) These CPUs do have AVX2, satisfying the stated requirement, but cannot execute `clwb`. ## Call stack ``` #0 victory-image-b99f876b74d4a77f.dll+0x4ecc84a ; clwb loop #1 victory-image-b99f876b74d4a77f.dll+0x247905f #2 victory-image-b99f876b74d4a77f.dll+0x19f4f54 #3 victory-image-b99f876b74d4a77f.dll+0x580437e #4 victory-image-b99f876b74d4a77f.dll+0x43a4911 #5 victory-image-b99f876b74d4a77f.dll+0x224070b #6 victory-image-b99f876b74d4a77f.dll+0x23cf00a #7 victory-image-b99f876b74d4a77f.dll+0x2215eca #8 KERNEL32.DLL+0x2dda7 #9 ntdll.dll+0x7ee4c ``` Registers at the fault (from the diag build): ``` rax 0x17bc001f rcx 0x17bc0000 r9 0x17bc0000 rsp 0x8d3dfff3e0 ``` `r9` points into the title's mapped memory; `rax` is `r9 + 0x1f` (end of a 32-byte region, though the loop strides by 0x40). ## Suggestion Could VIctory detect `clwb` support at startup (CPUID `leaf 7, sub-leaf 0, EDX[6]`) and, when absent, trap `#UD` on `clwb` and fall back to `clflush` (or `clflushopt` if available, else `clflush`) on the same address? `clwb` and `clflush`/`clflushopt` take the same `m8` operand, so the emulation is a straight substitution of the opcode bytes. This would let the title run on all AVX2 CPUs, matching the README's stated requirement. Alternatively, the README's CPU requirement could be updated to "AVX2 **and CLWB**" to set expectations, though emulation seems preferable since the title presumably only needs the write-back effect, not `clwb` specifically. ## Reproduction ```powershell cargo build --profile diag -p victory --features diagnostics set VICTORY_CRASH_SAVE=0x4ecc84a:256 target\diag\victory.exe run <game dir>\game_scarlett_master.exe --execute ``` ## Attachments - `crashes.log` — the 3 crash records [crashes.log](https://github.com/user-attachments/files/35305191/crashes.log)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:50:27 +00:00
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-24 00:38 UTC · original

CLWB is the instruction #45 adds for Intel CPUs before Ice Lake, and it is merged now — main 7d33c46 is the merge of #45.

So the first thing worth trying is a build of current main (or a release binary from it): the loader's illegal-instruction handler (crates/victory-loader/src/crash.rs) should emulate clwb instead of faulting.

If it still crashes after that, the neighbouring class is #34 (open): the handler also emulates clzero loops and rdpru for the same reason. The crash log's exception address plus the CPU model is enough to tell which encoding was not recognised.

No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).

**@⁠DaviTostes** on GitHub · 2026-11-24 00:38 UTC · [original](https://github.com/Marvisak/VIctory/issues/108#issuecomment-7118278651) CLWB is the instruction **#45** adds for Intel CPUs before Ice Lake, and it is merged now — `main` `7d33c46` is the merge of #45. So the first thing worth trying is a build of current `main` (or a release binary from it): the loader's illegal-instruction handler (`crates/victory-loader/src/crash.rs`) should emulate `clwb` instead of faulting. If it still crashes after that, the neighbouring class is #34 (open): the handler also emulates `clzero` loops and `rdpru` for the same reason. The crash log's exception address plus the CPU model is enough to tell which encoding was not recognised. No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).
Author
Owner

@⁠lucastol3do on GitHub · 2026-11-24 00:41 UTC · original

Thank you — the fix works. I pulled main (7d33c46), rebuilt, and the title now boots past the crash. It loads all archives, connects audio, translates shaders, and presents frames (the first menus run at ~17–19 fps on this machine). No more 0xc000001d.

For anyone else on a Broadwell or older CPU: updating to current main is all that's needed, no binary patching required. The illegal-instruction handler emulates clwb transparently.

One question: how do you track what still needs doing? Is there a task board, a roadmap issue, or a list of known gaps somewhere (beyond the status table in the README)? I'd like to help if I can — whether that's testing specific subsystems, writing up reproducible cases from this hardware (a dual-socket Broadwell with a D3D12 GPU, which seems to be a configuration you haven't tested on), or picking up small tasks from the open issues.

Thanks again for the quick response and the fix.

**@⁠lucastol3do** on GitHub · 2026-11-24 00:41 UTC · [original](https://github.com/Marvisak/VIctory/issues/108#issuecomment-7118332220) Thank you — the fix works. I pulled `main` (7d33c46), rebuilt, and the title now boots past the crash. It loads all archives, connects audio, translates shaders, and presents frames (the first menus run at ~17–19 fps on this machine). No more `0xc000001d`. For anyone else on a Broadwell or older CPU: updating to current `main` is all that's needed, no binary patching required. The illegal-instruction handler emulates `clwb` transparently. One question: how do you track what still needs doing? Is there a task board, a roadmap issue, or a list of known gaps somewhere (beyond the status table in the README)? I'd like to help if I can — whether that's testing specific subsystems, writing up reproducible cases from this hardware (a dual-socket Broadwell with a D3D12 GPU, which seems to be a configuration you haven't tested on), or picking up small tasks from the open issues. Thanks again for the quick response and the fix.
Author
Owner

@⁠Sunkiller-qc on GitHub · 2026-11-24 12:54 UTC · original

Since you confirmed that 7d33c46 (#45) gets you past the clwb crash, could you close this one?

#102, #103 and #210 fault at the same address (+0x4ecc84a) and were all built before #45 landed, so they should be closed too once their reporters retest.

**@⁠Sunkiller-qc** on GitHub · 2026-11-24 12:54 UTC · [original](https://github.com/Marvisak/VIctory/issues/108#issuecomment-7132072359) Since you confirmed that `7d33c46` (#45) gets you past the `clwb` crash, could you close this one? #102, #103 and #210 fault at the same address (`+0x4ecc84a`) and were all built before #45 landed, so they should be closed too once their reporters retest.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:48 UTC · original

Automated triage for the maintainers.

Fixed in main, as the reporter confirmed above: #45 (7d33c46) added clwb emulation for CPUs without it. The code is now in crates/victory-loader/src/crash.rs: emulate_amd_only skips a single clwb (clwb_len) and completes a whole write-back loop in one exception (clwb_loop, clwb_loop_end). The remaining reports of this crash are tracked in #102. One request for the future: please don't post disassembly of the title's code here; the crash address and VIctory's log lines are enough.

This issue will be closed in 48 hours unless the reporter replies or a maintainer removes the triage: proposed close label.

On the question in the comments about what still needs doing: open issues and PRs are the task list; #49 collects tester results.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:48 UTC · [original](https://github.com/Marvisak/VIctory/issues/108#issuecomment-7149972735) <!-- victory-issue-triage v1 verdict=proposed-close seen=2026-11-24T12:54:03Z at=2026-11-25T01:52:20Z --> Automated triage for the maintainers. Fixed in `main`, as the reporter confirmed above: #45 (`7d33c46`) added `clwb` emulation for CPUs without it. The code is now in `crates/victory-loader/src/crash.rs`: `emulate_amd_only` skips a single `clwb` (`clwb_len`) and completes a whole write-back loop in one exception (`clwb_loop`, `clwb_loop_end`). The remaining reports of this crash are tracked in #102. One request for the future: please don't post disassembly of the title's code here; the crash address and VIctory's log lines are enough. This issue will be closed in 48 hours unless the reporter replies or a maintainer removes the `triage: proposed close` label. On the question in the comments about what still needs doing: open issues and PRs are the task list; #49 collects tester results. --- _Generated by [Claude Code](https://claude.ai/code)_
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/Marvisak--VIctory#108
No description provided.