loader/stacks: suspend target thread before querying and reading its TEB stack bounds #586
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!586
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-586"
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?
@AscilCH on GitHub · 2026-11-25 02:35 UTC · original
AscilCH:fix/loader-stacks-suspend-before-teb-read→main· +47 −22 · 1 files · 1 commits · openProblem
In
crates/victory-loader/src/stacks.rs,frames_of()queriedNtQueryInformationThread(ThreadBasicInformation)and directly dereferencedinfo.teb.add(1)/info.teb.add(2)(StackBase/StackLimit) while the target thread was still running, before callingSuspendThread(thread).OpenThread/NtQueryInformationThreadand readinginfo.teb, Windows unmapped its TEB andframes_of()crashed withSTATUS_ACCESS_VIOLATION.StackLimitandSuspendThread,unwind_intoreceived a stalelowbound and truncated the stack trace.Fix
SuspendThread(thread)first inframes_of(), then queryNtQueryInformationThread(ThreadBasicInformation)while suspended, verifystatus == 0 && info.exit_status == STATUS_PENDING && !info.teb.is_null(), checklow <= high, unwind, and always callResumeThread(thread).frames_of_handles_exited_thread_safely.Verification
cargo test -p victory-loader --all-features --locked stacks::tests: 2 passed, 0 failedcargo test -p victory-loader --locked: 24 unit + 3 integration passed, 0 failedcargo xtask policy: 169 files okcargo clippy -p victory-loader --all-targets --locked -- -D warnings: cleancargo clippy -p victory-loader --all-targets --all-features --locked -- -D warnings: clean(AI-assisted; synthetic unit tests only, no game data.)
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.