Repository navigation
GPU/queue: hold Queue::held behind Arc and Weak in WAITING to eliminate release/release_held UAF - #620
Open
AscilCH wants to merge 1 commit into
Open
GPU/queue: hold Queue::held behind Arc and Weak in WAITING to eliminate release/release_held UAF#620AscilCH wants to merge 1 commit into
AscilCH wants to merge 1 commit into
Conversation
…te release/release_held UAF WAITING previously stored raw Queue pointers (`usize`) while `release()` freed `Box<Queue>` (and its embedded `Mutex<Vec<Held>>`) before removing the pointer from `WAITING`, and `release_held()` cloned pointers out of `WAITING` and locked `(*(q as *const Queue)).held` across GPU execution without synchronizing against concurrent `Release()`. - Store `Queue::held` as `Arc<Mutex<Vec<Held>>>` and store `(usize, Weak<...>)` entries in `WAITING`. - Upgrade the `Weak` handle in `release_held()` without dereferencing `q as *const Queue`, pruning dead entries via `Weak::ptr_eq` (also preventing ABA removal of a newly allocated Queue at the same address). - Add `register_waiting()` helper and synthetic unit tests for stale-entry pruning and concurrent `release_held` / `Queue::Release`.
KomanderDG88
pushed a commit
to KomanderDG88/VIniVIdiVIci
that referenced
this pull request
Nov 26, 2026
…cription The title may leave words 1 and 13 of the 56-byte resource description it passes to device methods 0x230/0x238 unwritten, so the same view came in with different bytes there and every one was a new shape: the 2^22 shapes were full after half an hour, after which each placed view was a table entry kept for the run (34.9 million, 16.7 GB after 70 minutes on Series S). Only the named fields are copied now; the padding is zero. From JMAN730/project-flamingo b1e0cd1d (merged there through PR fxceless#620), with its test. (cherry picked from commit f07e54a2bf2a6d925a7c535c2b5ee24d07b5872c, TaynanGT/Vice-Tay PR fxceless#27) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PiloteCode
pushed a commit
to PiloteCode/victory-fork
that referenced
this pull request
Nov 27, 2026
…cription The title may leave words 1 and 13 of the 56-byte resource description it passes to device methods 0x230/0x238 unwritten, so the same view came in with different bytes there and every one was a new shape: the 2^22 shapes were full after half an hour, after which each placed view was a table entry kept for the run (34.9 million, 16.7 GB after 70 minutes on Series S). Only the named fields are copied now; the padding is zero. From JMAN730/project-flamingo b1e0cd1d (merged there through PR fxceless#620), with its test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DKTTT
pushed a commit
to DKTTT/victory-nvidia-8gb
that referenced
this pull request
Nov 27, 2026
…cription The title may leave words 1 and 13 of the 56-byte resource description it passes to device methods 0x230/0x238 unwritten, so the same view came in with different bytes there and every one was a new shape: the 2^22 shapes were full after half an hour, after which each placed view was a table entry kept for the run (34.9 million, 16.7 GB after 70 minutes on Series S). Only the named fields are copied now; the padding is zero. From JMAN730/project-flamingo b1e0cd1d (merged there through PR fxceless#620), with its test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit f07e54a) (cherry picked from commit 4eead678b38937f2156b3e151f1e15682c518ae6)
hkmodd
pushed a commit
to hkmodd/victory-fork
that referenced
this pull request
Nov 27, 2026
…cription The title may leave words 1 and 13 of the 56-byte resource description it passes to device methods 0x230/0x238 unwritten, so the same view came in with different bytes there and every one was a new shape: the 2^22 shapes were full after half an hour, after which each placed view was a table entry kept for the run (34.9 million, 16.7 GB after 70 minutes on Series S). Only the named fields are copied now; the padding is zero. From JMAN730/project-flamingo b1e0cd1d (merged there through PR fxceless#620), with its test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit f07e54a) (cherry picked from commit 4eead67)
lahouuuu
pushed a commit
to lahouuuu/victory-fork
that referenced
this pull request
Nov 27, 2026
…cription The title may leave words 1 and 13 of the 56-byte resource description it passes to device methods 0x230/0x238 unwritten, so the same view came in with different bytes there and every one was a new shape: the 2^22 shapes were full after half an hour, after which each placed view was a table entry kept for the run (34.9 million, 16.7 GB after 70 minutes on Series S). Only the named fields are copied now; the padding is zero. From JMAN730/project-flamingo b1e0cd1d (merged there through PR fxceless#620), with its test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit f07e54a) (cherry picked from commit 4eead67)
oz-stanislav-zhukov
pushed a commit
to oz-stanislav-zhukov/victory-fork
that referenced
this pull request
Nov 28, 2026
…cription The title may leave words 1 and 13 of the 56-byte resource description it passes to device methods 0x230/0x238 unwritten, so the same view came in with different bytes there and every one was a new shape: the 2^22 shapes were full after half an hour, after which each placed view was a table entry kept for the run (34.9 million, 16.7 GB after 70 minutes on Series S). Only the named fields are copied now; the padding is zero. From JMAN730/project-flamingo b1e0cd1d (merged there through PR fxceless#620), with its test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit f07e54a)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In
crates/victory-gpu/src/queue.rs,WAITING: Mutex<Vec<usize>>stored raw*const Queuepointers without holding any lifetime guarantee:release(),object::release_boxed::<Queue>(this)dropped and freedBox<Queue>(and its embeddedheld: Mutex<Vec<Held>>) before removingthisfromWAITING.release_held(), raw pointers were cloned out ofWAITINGand dereferenced viaunsafe { &(*(q as *const Queue)).held }while locking the mutex acrosshost.execute(&runs)with no synchronization against a concurrentID3D12CommandQueue::Release().If one thread released a waiting queue while another thread ran
release_held(),release_held()could dereference freed memory, lock a destroyedMutex, or drop aMutexGuardonto freed memory. In addition, removing by raw address afterrelease_boxedrisked removing a newerQueueallocated at the same address (ABA).Fix
Queue::heldtoArc<Mutex<Vec<Held>>>and changeWAITINGto store(usize, Weak<Mutex<Vec<Held>>>)entries.register_waiting(this)to register(id, Arc::downgrade(&queue(this).held))(replacing any stale entry for the same address).release(), downgradequeue(this).heldbeforerelease_boxed::<Queue>(this), and remove only the matchingWeak::ptr_eqentry whenleft == 0.release_held(), upgrade eachWeakhandle safely instead of dereferencingq as *const Queue, pruning dead entries viaWeak::ptr_eq.releasing_waiting_queue_prunes_waiting_and_never_uafs_on_release_heldandconcurrent_release_held_and_queue_release_do_not_uaf.Verification
cargo test -p victory-gpu --locked queue::tests -- --test-threads=1: 6 passed, 0 failedcargo xtask policy: 169 files okcargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings: clean (default-features build onc96b4f2has only the pre-existingdead_codewarning onplaced_filler_twins, tracked in GPU: keep clippy green without the diagnostics feature #491)(AI-assisted; synthetic unit tests only, no game data.)