GPU/draw: evict CBV-backed fresh_tables on State::replay across cut lists #742
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!742
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-742"
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 06:09 UTC · original
AscilCH:fix/gpu-draw-replay-cbv-fresh-tables-uaf→main· +55 −5 · 1 files · 1 commits · openSummary
Fixes a GPU use-after-free and stale-constant bug when a command list is cut at a memory wait (
crates/victory-gpu/src/draw.rs):State::tablespopulates a dynamic descriptor table containing aView::Constant(address, size), the CBV points to the currentHostList's scratch upload memory (list.scratch(size)) and registerslist.defer_fill(...)only on thatHostList.list::cutsplits the command list at a memory wait and runsState::replayon a freshHostList(H2),State::replaypreviously retained allfresh_tablesentries. IfH2reused a cached CBV table, it pointed intoH1's scratch upload buffer without registeringdefer_fillonH2.H1executes and resets (list::recycle->H1.reset()) beforeH2is released from its value wait,H1's upload buffers are dropped or returned to the scratch pool whileH2still references their GPU VAs (and any constant-buffer updates written beforeH2runs are never copied).State::fresh_tablesnow tracks(first_slot, has_cbv)andState::replayevicts all CBV-backed entries (retain(|_, &mut (_, has_cbv)| !has_cbv)), while preserving non-CBV tables and keepingself.dynamicalive until the final part's state drops.Verification
cargo test -p victory-gpu --locked -- draw::replay_tests: 1 passed, 0 failedcargo clippy -p victory-gpu --all-targets --all-features --locked: 0 new warnings (pre-existing8dd30abwarnings indraw.rs:2377andindirect.rs:1322untouched)cargo xtask policy:171 files ok(AI-assisted; synthetic unit tests only, no game data.)
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.