[Linux/Proton] 0xC0000005 in title code after 3–20 min: range allocator race (+0xbc0380 / +0xad533c / +0x2215c35), RX 6800 XT RADV #395

Open
opened 2026-12-06 00:07:31 +00:00 by github-bot · 3 comments
Owner

@⁠Vallot-hub on GitHub · 2026-12-06 00:05 UTC · original

I had a crash while playing with LARP, so I asked Claude to solve it. Below his analysis; i hope it can help

Note: the crash analysis below (root cause, disassembly reading, address math) was done by an AI assistant (Claude) from my play.log, the game executable and the VIctory-xmem source. I checked the setup and the crashes myself; please double-check the reverse-engineering parts.

Summary

Random 0xC0000005 crashes ([larp exited with code -1073741819]) after 3–20 minutes of normal free-roam play on Linux/Proton. Crashes 1 and 3 are both a -1 link from the title's own 16-bit range allocator, and crash 2 is the watchdog after a hang (same address as #66). I found no open or merged PR that touches this allocator.

Setup

  • larp: v1.1.2 [Linux / Proton], linux-test 055b28a + PR #183 wide-heap shaders
  • Game: series-x profile
  • OS: Fedora 45, kernel 7.3.4
  • GPU: AMD Radeon RX 6800 XT (Navi 21), Mesa 26.2.7 RADV
  • Proton: Proton Experimental 11.0-20261203b (via run.sh / umu-run)
  • Native d3dcompiler_47 installed, host ray tracing on

Crashes

There is no warning in the log beforehand. The faulting code is always in the title image, and all three stacks go through the same thread entry (+0x221c29c -> +0x2215eca).

Crash 1 (~12 min)

unhandled exception 0xc0000005 at larp-image-b99f876b74d4a77f.dll+0x2626911 (write 0x215d397680: nothing mapped there)
  rax 0xd5d397690 ...
  #0 +0x2626911  #1 +0x26268da  #2 +0xbc0576  #3 +0xbc03b5  #4 +0x82cd46
  #5 +0x300292   #6 +0x51c39e1  #7 +0x257035e #8 +0x221c29c #9 +0x2215eca

Crash 2 (~3 min), same watchdog address as #66 (fixed by PR #103 for the binoculars scene; mine was in free roam)

unhandled exception 0xc0000005 at larp-image-b99f876b74d4a77f.dll+0x2215c35 (write 0x0: nothing mapped there)
  #0 +0x2215c35  #1 +0x2215eca

Crash 3 (~20 min)

unhandled exception 0xc0000005 at larp-image-b99f876b74d4a77f.dll+0xad533c (write 0x215d3ac67e: nothing mapped there)
  rax 0xd5d3ac690 rbx 0x7d3 rcx 0xb37 rdx 0x7d3 rsi 0xb37ffff rdi 0xb37 ...
  #0 +0xad533c  #1 +0xad524c  #2 +0xad5054  #3 +0xad4f96  #4 +0xad4768
  #5 +0xbc478   #6 +0x4f4b23a #7 +0x4f4b1e0 #8 +0x256fb83 #9 +0x221c29c #10 +0x2215eca

Analysis (AI-assisted, checked against the 1.0.2.1 exe disassembly)

The title's range allocator uses 16-bit node indices. The node array is at +0x908f020, 20-byte nodes; the slots are at +0x908eff0. All offsets are image offsets of game_scarlett_master.exe 1.0.2.1, which match the larp-image offsets.

1. TOCTOU race in slot ensure (+0xbc0380)

  • It reads the slot's A/B sizes (+0xbc0470, +0xbc0450) without the allocator lock.
  • It then calls slot_free_a/slot_alloc_a (+0xbc04d0/+0xbc0530) and slot_free_b/slot_alloc_b (+0xbc05b0/+0xbc0670), and tail-jumps to +0xbc0750.
  • Each of those helpers takes the recursive lock +0x76b8e70 (via +0x4b40, released via a tail jump to +0x4d9dab0) only around itself.
  • Two workers on the same slot can both pass the size check and overwrite a live node, which corrupts the doubly linked lists.

2. -1 accepted as a free node (+0xad52d0, is_free_node)

  • It returns true when cx >= [+0x908f02e] && cx != [+0x908f030] && cx != [+0x908f032], so 0xffff passes.
  • [+0x908f030] looks like the end index: +0xad51a2..+0xad51cf scans nodes up to the count and then compares the result against it.

3. How a -1 link becomes these exact fault addresses
At +0xad532d..+0xad533c the next link is loaded with movswq (%r8), %r11, then zero-extended with movl %r11d, %r11d, so -1 becomes 0xffffffff. It is then scaled by 20 (lea (%r11,%r11,4) + *4):

  • crash 3: 0x215d3ac67e - rax 0xd5d3ac690 = 0x13FFFFFFEE = 0xffffffff*20 + 2 (the movw %cx, 0x2(%rax,%r11,4) store), with rsi 0xb37ffff ending in ffff
  • crash 1: 0x215d397680 - rax 0xd5d397690 = 0x13FFFFFFF0 = 0xffffffff*20 + 4: the same -1 link, reached from slot ensure (+0xbc03b5 is the return after call +0xbc0530, and +0xbc0576 is inside it, after call +0x2626830)
  • crash 2: this is the title's watchdog (write to 0 at +0x2215c35) after a hang. The allocator race can cause such a hang (corrupted lists become a cycle), but so can the view-finish spin that PR #103 guards against. The stall dump of that run was overwritten, so I cannot tell which one it was. (Speculation: PR #103 notes that "a few objects simply reach the job without having been inserted for that frame"; allocator corruption might be one way that happens.)

Existing fix (VIctory-xmem)

VIctory-xmem (another Xbox Series emulator for this title) fixes both at load time. The fix, by vMohammad24, was merged upstream in lobomfz/VIctory-xmem#466 (commit a8df01c on main; ddf57e7 on rdna2-3). Code: crates/victory-loader/src/range_allocator.rs:

  1. Lock wrap: a 14-byte absolute jump over the 15-byte prologue of +0xbc0380 (56 57 55 53 48 83 EC 28 41 8B 68 04 4C 89 C7, no RIP-relative instructions) to a wrapper that holds +0x76b8e70 across the whole call, via a trampoline.
  2. Sentinel check: je -> jbe at +0xad52e2 (bytes at +0xad52db: 66 39 0D 4E 9D 5B 08 74 0A -> ... 76 0A), so any index >= [+0x908f030] is not a free node.

The expected bytes at both sites match this exe. VIctory logs range allocator: slot ensure wrapped with lock and is_free_node sentinel check patched at every start on this machine.

Could larp apply the same two patches?

Notes

  • Ruled out: frame generation (off), the [untested] settings (all default).
  • OptiScaler 0.9.5 (as dxgi.dll, FSR4 INT8) was loaded during these runs, but no stack touches it, and the faults are CPU writes in title code.
  • play.log of the last crash attached.
**@⁠Vallot-hub** on GitHub · 2026-12-06 00:05 UTC · [original](https://github.com/gamingwithhomie/larp/issues/395) I had a crash while playing with LARP, so I asked Claude to solve it. Below his analysis; i hope it can help **Note:** the crash analysis below (root cause, disassembly reading, address math) was done by an AI assistant (Claude) from my play.log, the game executable and the [VIctory-xmem](https://github.com/lobomfz/VIctory-xmem) source. I checked the setup and the crashes myself; please double-check the reverse-engineering parts. ### Summary Random 0xC0000005 crashes (`[larp exited with code -1073741819]`) after 3–20 minutes of normal free-roam play on Linux/Proton. Crashes 1 and 3 are both a -1 link from the title's own 16-bit range allocator, and crash 2 is the watchdog after a hang (same address as #66). I found no open or merged PR that touches this allocator. ### Setup - **larp:** v1.1.2 [Linux / Proton], linux-test 055b28a + PR #183 wide-heap shaders - **Game:** series-x profile - **OS:** Fedora 45, kernel 7.3.4 - **GPU:** AMD Radeon RX 6800 XT (Navi 21), Mesa 26.2.7 RADV - **Proton:** Proton Experimental 11.0-20261203b (via run.sh / umu-run) - Native d3dcompiler_47 installed, host ray tracing `on` ### Crashes There is no warning in the log beforehand. The faulting code is always in the title image, and all three stacks go through the same thread entry (`+0x221c29c` -> `+0x2215eca`). **Crash 1** (~12 min) ``` unhandled exception 0xc0000005 at larp-image-b99f876b74d4a77f.dll+0x2626911 (write 0x215d397680: nothing mapped there) rax 0xd5d397690 ... #0 +0x2626911 #1 +0x26268da #2 +0xbc0576 #3 +0xbc03b5 #4 +0x82cd46 #5 +0x300292 #6 +0x51c39e1 #7 +0x257035e #8 +0x221c29c #9 +0x2215eca ``` **Crash 2** (~3 min), same watchdog address as #66 (fixed by PR #103 for the binoculars scene; mine was in free roam) ``` unhandled exception 0xc0000005 at larp-image-b99f876b74d4a77f.dll+0x2215c35 (write 0x0: nothing mapped there) #0 +0x2215c35 #1 +0x2215eca ``` **Crash 3** (~20 min) ``` unhandled exception 0xc0000005 at larp-image-b99f876b74d4a77f.dll+0xad533c (write 0x215d3ac67e: nothing mapped there) rax 0xd5d3ac690 rbx 0x7d3 rcx 0xb37 rdx 0x7d3 rsi 0xb37ffff rdi 0xb37 ... #0 +0xad533c #1 +0xad524c #2 +0xad5054 #3 +0xad4f96 #4 +0xad4768 #5 +0xbc478 #6 +0x4f4b23a #7 +0x4f4b1e0 #8 +0x256fb83 #9 +0x221c29c #10 +0x2215eca ``` ### Analysis (AI-assisted, checked against the 1.0.2.1 exe disassembly) The title's range allocator uses 16-bit node indices. The node array is at `+0x908f020`, 20-byte nodes; the slots are at `+0x908eff0`. All offsets are image offsets of game_scarlett_master.exe 1.0.2.1, which match the larp-image offsets. **1. TOCTOU race in slot ensure (`+0xbc0380`)** - It reads the slot's A/B sizes (`+0xbc0470`, `+0xbc0450`) **without the allocator lock**. - It then calls slot_free_a/slot_alloc_a (`+0xbc04d0`/`+0xbc0530`) and slot_free_b/slot_alloc_b (`+0xbc05b0`/`+0xbc0670`), and tail-jumps to `+0xbc0750`. - Each of those helpers takes the recursive lock `+0x76b8e70` (via `+0x4b40`, released via a tail jump to `+0x4d9dab0`) only around itself. - Two workers on the same slot can both pass the size check and overwrite a live node, which corrupts the doubly linked lists. **2. -1 accepted as a free node (`+0xad52d0`, is_free_node)** - It returns true when `cx >= [+0x908f02e] && cx != [+0x908f030] && cx != [+0x908f032]`, so `0xffff` passes. - `[+0x908f030]` looks like the end index: `+0xad51a2..+0xad51cf` scans nodes up to the count and then compares the result against it. **3. How a -1 link becomes these exact fault addresses** At `+0xad532d..+0xad533c` the next link is loaded with `movswq (%r8), %r11`, then zero-extended with `movl %r11d, %r11d`, so -1 becomes `0xffffffff`. It is then scaled by 20 (`lea (%r11,%r11,4)` + `*4`): - **crash 3:** `0x215d3ac67e - rax 0xd5d3ac690 = 0x13FFFFFFEE = 0xffffffff*20 + 2` (the `movw %cx, 0x2(%rax,%r11,4)` store), with `rsi 0xb37ffff` ending in `ffff` - **crash 1:** `0x215d397680 - rax 0xd5d397690 = 0x13FFFFFFF0 = 0xffffffff*20 + 4`: the same -1 link, reached from slot ensure (`+0xbc03b5` is the return after `call +0xbc0530`, and `+0xbc0576` is inside it, after `call +0x2626830`) - **crash 2:** this is the title's watchdog (write to 0 at `+0x2215c35`) after a hang. The allocator race can cause such a hang (corrupted lists become a cycle), but so can the view-finish spin that PR #103 guards against. The stall dump of that run was overwritten, so I cannot tell which one it was. (Speculation: PR #103 notes that "a few objects simply reach the job without having been inserted for that frame"; allocator corruption might be one way that happens.) ### Existing fix (VIctory-xmem) [VIctory-xmem](https://github.com/lobomfz/VIctory-xmem) (another Xbox Series emulator for this title) fixes both at load time. The fix, by vMohammad24, was merged upstream in [lobomfz/VIctory-xmem#466](https://github.com/lobomfz/VIctory-xmem/pull/466) (commit [`a8df01c`](https://github.com/lobomfz/VIctory-xmem/commit/a8df01cd62c872ea3e5abe2f88027a4ebb5d28e9) on `main`; [`ddf57e7`](https://github.com/lobomfz/VIctory-xmem/commit/ddf57e7a46b1674a19bab46bd27a767b66838306) on `rdna2-3`). Code: [`crates/victory-loader/src/range_allocator.rs`](https://github.com/lobomfz/VIctory-xmem/blob/main/crates/victory-loader/src/range_allocator.rs): 1. **Lock wrap:** a 14-byte absolute jump over the 15-byte prologue of `+0xbc0380` (`56 57 55 53 48 83 EC 28 41 8B 68 04 4C 89 C7`, no RIP-relative instructions) to a wrapper that holds `+0x76b8e70` across the whole call, via a trampoline. 2. **Sentinel check:** `je` -> `jbe` at `+0xad52e2` (bytes at `+0xad52db`: `66 39 0D 4E 9D 5B 08 74 0A` -> `... 76 0A`), so any index `>= [+0x908f030]` is not a free node. The expected bytes at both sites match this exe. VIctory logs `range allocator: slot ensure wrapped with lock` and `is_free_node sentinel check patched` at every start on this machine. Could larp apply the same two patches? ### Notes - Ruled out: frame generation (off), the `[untested]` settings (all `default`). - OptiScaler 0.9.5 (as dxgi.dll, FSR4 INT8) was loaded during these runs, but no stack touches it, and the faults are CPU writes in title code. - play.log of the last crash attached.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-06 00:07:32 +00:00
Author
Owner

@⁠Vallot-hub on GitHub · 2026-12-06 00:06 UTC · original

play.log

**@⁠Vallot-hub** on GitHub · 2026-12-06 00:06 UTC · [original](https://github.com/gamingwithhomie/larp/issues/395#issuecomment-7448088181) [play.log](https://github.com/user-attachments/files/35924964/play.log)
Author
Owner

@⁠vanya890 on GitHub · 2026-12-06 01:18 UTC · original

The allocator-race hypothesis is technically plausible from the described 0xffff link and the unsynchronised slot-size check, but I would keep the two failures separate for now: crashes 1/3 have the proposed allocator signature, while crash 2 is explicitly ambiguous between an allocator-corrupted list and the existing view-finish watchdog path.

I would not transplant the VIctory-xmem byte patches unconditionally. The offsets and expected bytes are tied to the exact game_scarlett_master.exe build you disassembled; a title update can move either function or change its prologue while leaving the LARP image offsets misleadingly similar. Before implementing this in LARP, the patch should fail closed unless the loaded title image/version and both complete expected instruction sequences match, and the trampoline must preserve every overwritten instruction and calling convention. Please add the SHA-256 of the exact game executable used for the disassembly (and confirm whether all three crashes came from that same binary). That gives maintainers a reproducible target rather than a patch recipe that could corrupt a different build.

**@⁠vanya890** on GitHub · 2026-12-06 01:18 UTC · [original](https://github.com/gamingwithhomie/larp/issues/395#issuecomment-7449077655) The allocator-race hypothesis is technically plausible from the described `0xffff` link and the unsynchronised slot-size check, but I would keep the two failures separate for now: crashes 1/3 have the proposed allocator signature, while crash 2 is explicitly ambiguous between an allocator-corrupted list and the existing view-finish watchdog path. I would not transplant the VIctory-xmem byte patches unconditionally. The offsets and expected bytes are tied to the exact `game_scarlett_master.exe` build you disassembled; a title update can move either function or change its prologue while leaving the LARP image offsets misleadingly similar. Before implementing this in LARP, the patch should fail closed unless the loaded title image/version and both complete expected instruction sequences match, and the trampoline must preserve every overwritten instruction and calling convention. Please add the SHA-256 of the exact game executable used for the disassembly (and confirm whether all three crashes came from that same binary). That gives maintainers a reproducible target rather than a patch recipe that could corrupt a different build.
Author
Owner

@⁠Vallot-hub on GitHub · 2026-12-06 02:11 UTC · original

Thank you for your response

These is the sha-265 : e95020b2fa4a721db3df59fdecf75621730ac559d8835252f6c3b658d5a08993 game_scarlett_master.exe
I can confirm that all three crashes originate from the same binary.

**@⁠Vallot-hub** on GitHub · 2026-12-06 02:11 UTC · [original](https://github.com/gamingwithhomie/larp/issues/395#issuecomment-7449753608) Thank you for your response These is the sha-265 : e95020b2fa4a721db3df59fdecf75621730ac559d8835252f6c3b658d5a08993 game_scarlett_master.exe I can confirm that all three crashes originate from the same binary.
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/gamingwithhomie--larp#395
No description provided.