Crash reports: say what an access violation's address holds #204
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!204
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/204/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Dufftwt on GitHub · 2026-11-24 01:24 UTC · original
Dufftwt:fix/crash-report-fault-memory→main· +78 −1 · 1 files · 1 commits · merged 2026-11-24 07:54 UTCWhat's wrong
An access violation is reported with the kind of access and the address it touched, and nothing else:
The address alone can't tell apart causes that need completely different fixes:
Today, finding out which one it was means asking the reporter for a dump and a debugger session. #99 is an example: three runs show "a write below 4 GB" with nothing more to go on.
What the fix does
reportincrash.rsnow asksVirtualQuerywhat is at the faulting address, and adds the answer after the address. A new helper,memory_at, turns the answer into one of these:nothing mapped therereserved, never committeda guard pageread-only,read-write,read-execute,no access, …), and the module name with offset when the page belongs to a loaded imageoutside the address space, for addressesVirtualQueryrejects, such as the all-ones address Windows reports for a non-canonical pointerIt only queries the address space; it never reads the faulting address itself, so it can't fault inside the handler. Other exceptions and the rest of the report don't change.
How it behaves after the fix
A report now says by itself whether a crash is a bad pointer, an allocation that never got its memory, a stack overrun, or a write to protected memory.
Tests
The new test
memory_at_names_what_an_access_hitreserves four pages and commits three of them as read-only, guard and no-access. It checks each description, then checks free memory (after releasing the pages, and address 0), an address past the end of the address space, and the test's own code (read-execute, in victory_loader-….exe+0x…).I ran
cargo test --workspaceon GitHub'swindows-latestwith Rust 1.98.1 fromrust-toolchain.toml:victory-loaderhas 19 passed, the other crates have 0 failed.reportfour writes: into reserved pages, a guard page, address0x18, and the all-ones address. Onmain: With this PR:--test-threads=1. With 4 threads, the shader crate's GPU tests sometimes crash on that runner (STATUS_ACCESS_VIOLATION), on unmodifiedmainas well.Not tested: a real crash in the title.
Related: #23, #99. #12 and #34 also edit
crash.rs; both already conflict withmain, and this change adds no conflict of its own with either. It merges cleanly with #198, which adds the bytes of an illegal instruction to the same report line.@jeremygold02 on GitHub · 2026-11-24 04:45 UTC · original
Thanks @Dufftwt for the access-violation report detail. I tested the open PR at head
3390e47328e057badbb3cf2a2f565a3a05291960with:Result: 1 passed, 0 failed. The test exercises
VirtualQueryclassification for reserved-but-uncommitted, read-only, guard, no-access, released/free, null, and out-of-address-space locations, then checks module naming for an image page. These are synthetic memory-region checks; they do not exercise crash handling in a real title. The test is in crash.rs.