modules: a crash report survives an address below its module's base #147

Closed
github-bot wants to merge 1 commit from gh-pr/147/head into gh-pr/147/base
Owner

@⁠gefydev on GitHub · 2026-11-23 15:35 UTC · original
gefydev:gta6-startup → main · +37 −1 · 1 files · 1 commits · closed without merging

Running the 2026 retail build (MicrosoftGame.Config title memory "Advanced") under Wine with the console's own files, XCL's report of a title fault panicked instead of being printed:

thread '<unnamed>' panicked at crates/xcl/src/modules.rs:154:44: attempt to subtract with overflow

describe_address scans raw stack words; Wine's GetModuleHandleExW answered one of them with a module handle above the address, and addr - h overflowed. In a debug build that is a panic (the crash report was lost and the process ended with 0xC0000409); in release it is a nonsense offset.

The offset now goes through checked_sub and an address below its module's handle is printed as the bare address. Two unit tests cover it.

Verified: the same title under Wine now prints its actual fault instead of panicking (CRASH: unhandled exception 0xc0000005 ...), and cargo test --target x86_64-pc-windows-gnu -p xcl --lib modules::tests passes (550 lib tests in that binary; the two new ones and the rest of the filter ran).

No relation to the D3D12ConfigureVirtualMemoryX startup fix in #142 – that one is needed first to get this far.

**@⁠gefydev** on GitHub · 2026-11-23 15:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/147) `gefydev:gta6-startup` → `main` · +37 −1 · 1 files · 1 commits · closed without merging Running the 2026 retail build (`MicrosoftGame.Config` title memory "Advanced") under Wine with the console's own files, XCL's report of a title fault panicked instead of being printed: ``` thread '<unnamed>' panicked at crates/xcl/src/modules.rs:154:44: attempt to subtract with overflow ``` `describe_address` scans raw stack words; Wine's `GetModuleHandleExW` answered one of them with a module handle above the address, and `addr - h` overflowed. In a debug build that is a panic (the crash report was lost and the process ended with 0xC0000409); in release it is a nonsense offset. The offset now goes through `checked_sub` and an address below its module's handle is printed as the bare address. Two unit tests cover it. Verified: the same title under Wine now prints its actual fault instead of panicking (`CRASH: unhandled exception 0xc0000005 ...`), and `cargo test --target x86_64-pc-windows-gnu -p xcl --lib modules::tests` passes (550 lib tests in that binary; the two new ones and the rest of the filter ran). No relation to the `D3D12ConfigureVirtualMemoryX` startup fix in #142 – that one is needed first to get this far.
With the retail build (Rockstar, "title memory Advanced") running under Wine,
reporting an unhandled exception panicked in describe_address: Wine answered a
stack word with a module handle above the address, and addr - h overflowed in a
debug build (a nonsense offset in release). The panic replaced the crash report,
so the title's actual fault (an AV) was lost.

The offset now goes through checked_sub; an address below its module's handle is
printed as the bare address.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:12:33 +00:00
github-bot closed this pull request 2026-11-26 04:12:33 +00:00
Author
Owner

@⁠ivall on GitHub · 2026-11-23 21:09 UTC · original

Merged as a squash commit (36fcd9a-equivalent on main, "modules: a crash report survives an address below its module's base (PR #147, gefydev)") so the commit message carries no game title. Checked on an RX 9070 (RDNA4) with the 22 PRs merged together on main eaa36b6: cargo build --workspace && cargo test --workspace -- --test-threads=4 - 582 unit tests passed, 0 failed (20 ignored), the integration and e2e tests passed too; and the retail game still reaches its first menu (646 frames in 30 s, no device removal).

**@⁠ivall** on GitHub · 2026-11-23 21:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/147#issuecomment-7114081423) Merged as a squash commit (36fcd9a-equivalent on main, "modules: a crash report survives an address below its module's base (PR #147, gefydev)") so the commit message carries no game title. Checked on an RX 9070 (RDNA4) with the 22 PRs merged together on main eaa36b6: `cargo build --workspace && cargo test --workspace -- --test-threads=4` - 582 unit tests passed, 0 failed (20 ignored), the integration and e2e tests passed too; and the retail game still reaches its first menu (646 frames in 30 s, no device removal).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.