Loader: a fault while reporting one is not reported again #3520
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!3520
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3520"
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?
@gkissel on GitHub · 2026-11-27 12:41 UTC · original
gkissel:crash-report-reentrancy→main· +94 −1 · 1 files · 2 commits · openAI-assisted (Claude). Measured on my own machine. What was and was not run is listed under "Tested".
Problem
Under Wine, a fault inside the crash report re-enters the vectored handler on the same thread. That report faults the same way, and the thread recurses until its stack runs out. The first report is lost and the thread dies on a stack overflow instead of the original exception.
What I saw (GTX 1650 Mobile, NVIDIA 620.70.06, Wine 11.21, vkd3d-proton 3.1, Linux): the host driver's shader compiler faulted on a pipeline worker. Wine then logged
virtual_setup_exception stack overflowon two workers, at the same instruction each time. That instruction symbolizes (PDB of a local build) tovictory_loader::crash::locate. Raising the worker stacks from 2 MiB to 64 MiB (RUST_MIN_STACK) moved nothing: the overflow came at the same instruction. So this is recursion, not a small stack.locateis only the deepest frame when the stack ran out. I did not pin down which call insidereportfaults first.Change
reportkeeps a thread-local flag. If the thread is already reporting, it returns, and the nested exception goes on unreported to the next handler. This covers both callers, the vectored handler and the unhandled-exception filter. The body ofreportis unchanged and now lives inreport_once.Known limit, also noted in the code: if a report never returns, the flag stays set and that thread reports nothing more.
This does not overlap #1897, which recovers a faulting
RtlVirtualUnwindinside the walk, or #2401, which keeps a Wine compiler crash from ending the run. Those remove two causes of a fault in or around the report. This one stops any fault in the report from recursing.Also,
module_ofuseschecked_subnow. Under Wine 11.21,GetModuleHandleExW(FROM_ADDRESS)succeeded for aVirtualAllocpage and returned a module above the address, solocatepanicked on the subtraction in a test build. That was another fault inside the report. Such an address is now shown bare.Tested
cargo clippy -p victory-loader --all-targets --locked -- -D warnings, with and without--all-features, cross-built forx86_64-pc-windows-msvcon Linux: clean.cargo xtask policy: ok.cargo test -p victory-loaderunder Wine 11.21: 35 passed, 1 failed. The failure isconcurrent_crash_records_stay_together, which also fails 3 of 3 on base under Wine (#3092).a_fault_while_reporting_is_not_reported_again: a report whose own instruction-bytes read faults, with a later handler reopening the page. Under Wine 11.21 it fails without the flag (2 reports) and passes with it (1).handlerrather than inreport. This PR moves it intoreportso the unhandled filter is covered too.@copilot-pull-request-reviewer[bot] on GitHub · 2026-11-27 12:41 UTC · original · reviewed
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
@oni-swr on GitHub · 2026-11-27 13:25 UTC · original
Independent WARP/CPU verification of #3520 at head
771b5d68(base: main63bcca43, merge-base of this PR). Head re-checked unchanged just before posting.Setup: Windows 11 Pro 10.0.26200, AMD Ryzen 7 5700X3D,
VICTORY_WARP=1 VICTORY_D3D12_WARP=1set, though this crate does not use the GPU. Base and head were built in separate worktrees with separate target dirs. Test command:cargo test -p victory-loader --features diagnostics.cargo clippy -p victory-loader --features diagnostics --all-targets -- -D warningspasses on the head and on base.Diff review: no bug found.
constthread_local!Cell<bool>with no destructor, so reading it inside a fault or stack-overflow handler does not allocate or lazily register anything.try_with(..).unwrap_or(true)also skips reporting during thread teardown.AI-assisted: Claude Code, Claude Sonnet 5.5.
@gkissel on GitHub · 2026-11-27 13:55 UTC · original
Thanks for the independent run. I added the missing test in
4f58146.a_fault_while_reporting_is_not_reported_againPAGE_NOACCESSpage.reportreads the instruction bytes, so it faults inside itself.report_oncemust read 1.Run under Wine 11.21 (cross-built
x86_64-pc-windows-msvc,cargo test -p victory-loader --lib):left: 2, right: 1(the nested fault was reported as well);Second fix in the same commit
Writing the test exposed another problem: under Wine 11.21,
GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS)succeeded for a page fromVirtualAllocand returned a module above that address.module_ofthen panicked onaddress - modulewith "attempt to subtract with overflow" in the test build, which is itself a fault inside the report.module_ofnow useschecked_suband shows such an address bare.Whole crate under Wine: 35 passed, 1 failed. The failure is
concurrent_crash_records_stay_together. It fails 3 of 3 on base63bcca4as well (interleaved records under Wine, which #3092 addresses), so it is not caused by this PR.Clippy with
-D warningsis clean, with and without--all-features.cargo xtask policyis ok.@cloph-dsp on GitHub · 2026-11-27 14:12 UTC · original
Independent CPU-only verification on Windows / Rust 1.100.0 / MSVC.
4f581462233c48371a07fe14d453385bcda11b20, merge base63bcca43c6a00a758510398fa43096ce7e4f7df0.cargo test --locked -p victory-loader --lib -- crash::tests::a_fault_while_reporting_is_not_reported_again --exact --test-threads=1 --quiettest result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 35 filtered out, exit 0.git grep -F -c crash::tests::a_fault_while_reporting_is_not_reported_again 63bcca43 -- .→ exit 1 / 0 hits (test genuinely new).git diff --check 63bcca43 HEAD→ exit 0.@oddmaniv on GitHub · 2026-11-27 16:05 UTC · original
Independent verification of the PR author's concurrent WARP pipeline/draw test at
4f581462233c48371a07fe14d453385bcda11b20.cargo test --locked -p victory-shader --lib emit::host::tests::parallel_warp_pipelines_and_draws -- --exact --nocaptureMain baseline pin:
63bcca43c6a00a758510398fa43096ce7e4f7df0.Windows x86_64 MSVC native runs. Local and remote source snapshots matched before and after each check. The adaptation applies the PR diff without additional source edits.
This is focused regression coverage, not the full workspace suite, a gameplay test, or an independent validation of every behavior in the PR. No new fix is claimed.
AI-assisted verification.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.