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

Closed
gefydev wants to merge 1 commit from upstream-pr/147 into main
gefydev commented 2026-11-23 15:35:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gefydev on 2026-11-23T15:35:38Z.


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.

<!-- greyfinch-sync:ivall/xcl:issue:6562839339 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/147). Originally posted by [gefydev](https://github.com/gefydev) on 2026-11-23T15:35:38Z. --- 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.
upstream-sync closed this pull request 2026-11-24 06:57:23 +00:00
ivall commented 2026-11-24 07:04:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ivall on 2026-11-23T21:09:25Z.


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).

<!-- greyfinch-sync:ivall/xcl:comment:7114081423 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/147#issuecomment-7114081423). Originally posted by [ivall](https://github.com/ivall) on 2026-11-23T21:09:25Z. --- 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

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
xcl-dev/xcl!144
No description provided.