fix(victory-gpu): avoid TEXTURES self-deadlock and UAF in let_go_idle -> slot_evict #398
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!398
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-398"
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?
@Lewandox on GitHub · 2026-11-26 17:08 UTC · original
Lewandox:fix/resource-slot-evict-deadlock→main· +136 −78 · 1 files · 1 commits · merged 2026-11-26 17:14 UTCSummary
Fixes a guaranteed
TEXTURESmutex self-deadlock (and a follow-on use-after-free window) invictory-gpu'slet_go_idle->slot_evicteviction path (third_party/victory/crates/victory-gpu/src/resource.rs), as flagged unchecked indocs/research/stutter-2026-11-26.md:let_go_idlepreviously acquiredlet all = textures();and kept theTEXTURESmutex guard live across theslot_evict(...)call. WheneverVICTORY_SLOT_EVICT=1was enabled and VRAM usage exceededVICTORY_SLOT_EVICT_PERCENT(need > 0),slot_evictimmediately calledtextures().iter()on the same thread, permanently deadlocking the submitting thread. The idle sweep loop now drops theTEXTURESguard before callingslot_evict_with.slot_evict_with:TEXTURESlock after scanning candidates and before callingcrate::descriptor::evictable_slots/crate::descriptor::evict_slots(avoiding holdingTEXTURESacross descriptor heap locks).TEXTURESand verifiesall.contains(&at)before dereferencingat as *const Resourceduring eviction, so a texture concurrently freed byDrop for Resourcebetween the scan and eviction is safely skipped instead of causing a use-after-free.TEXTURESbefore callingcrate::host::retireorcrate::descriptor::texture_made.let_go_idle_with/slot_evict_withand addslet_go_idle_with_slot_evict_above_threshold_does_not_deadlockverifying the fulllet_go_idle->slot_evictpath completes above threshold without deadlocking.Verification
cargo test -p victory-gpu --lib resource::tests(default and--features diagnostics)cargo xtask policyinsidethird_party/victory