Profiler: unwind a copy of the sampled thread's stack (VICTORY_PROFILE no longer crashes the title) #1224
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!1224
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1224"
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?
@KelvinSilvaDev on GitHub · 2026-11-28 15:56 UTC · original
KelvinSilvaDev:fix/profiler-stack-copy→main· +172 −11 · 2 files · 1 commits · merged 2026-11-29 08:16 UTCVICTORY_PROFILEcrashed the process about when sampling began (twice in a row): an access violation inside ntdll (read 0x10067: nothing mapped there, thenread …: reserved, never committed), fromvictory_loader::stacks::frames_of→victory_loader::crash::unwind_into→RtlVirtualUnwind. Unwinding a live, just-suspended thread with the unwind data can makeRtlVirtualUnwindread through a frame register holding anything (after a step taken byrsp), or stack pages the thread never committed.What changes (2 files, +172/-11:
crates/victory-loader/src/crash.rs,crates/victory-loader/src/stacks.rs):frames_ofcopies the thread's stack (fromrspup, at most 512 KiB, zeros after) withReadProcessMemorywhile the thread is suspended (the kernel fails where memory is missing instead of faulting; the buffer is made before the suspend), resumes the thread, and unwinds the copy (crash::unwind_copy): stack registers that point into the copied range are moved into the copy, and a frame register that points elsewhere ends the walk.unwind_into(the crash handler's live walk) stops where a function that keeps a frame register has it outside the thread's stack, instead of lettingRtlVirtualUnwindread through it.Validation (Windows 11, RTX 3090, Ryzen 7 7700):
VICTORY_PROFILE=100,340,5,<file>on a diagnostics build ended the title at 100 s both times.cargo clippy --locked -p victory-loader --features diagnostics: no warnings.cargo test --locked -p victory-loader --features diagnostics --lib: 48 passed.cargo build --locked --profile diag -p victory --features diagnostics: ok.cargo fmt --checkalready reports files this PR does not touch, so the changed code follows the style around it.AI-assisted (Claude). No game data, no NVIDIA files.
🤖 Generated with Claude Code