loader/stacks: suspend target thread before querying and reading its TEB stack bounds #586
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from fxceless/victory-fork. Originally posted by AscilCH on 2026-11-25T02:35:36Z.
Problem
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.