fix(gpu/texture/ahead): close claim/listed TOCTOU window and handle copy-queue failures (#317) #336
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: launcher
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
run report
security: hold
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs gpu test
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Androtim--MiniVI!336
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-336"
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?
@RUIZ-Enrique-25002136 on GitHub · 2026-12-02 13:20 UTC · original
RUIZ-Enrique-25002136:fix/texture-ahead-race-and-error→main· +258 −61 · 1 files · 1 commits · merged 2026-12-02 13:34 UTCSummary
Fixes both concurrency and copy-queue error-handling bugs in
crates/victory-gpu/src/texture/ahead.rstracked in #317.Fixes #317
Changes
claim()/listed()TOCTOU window:ON_THEIR_WAYentries from(u64, Arc<Job>)to(u64, Option<Arc<Job>>)whereNonereserves acopy.serialslot atomically under theON_THEIR_WAYlock alongside theNONE -> PENDINGCAS.PendingGuardso ifstaging()returnsNone, fails filtering, or unwinds,copy.aheadis reverted toLISTED, the reservation is removed,IN_FLIGHTis updated, andLANDED.notify_all()wakes any waiters.wait_known()so concurrentclaim()calls encounteringPENDINGwait onLANDEDuntil the reservation resolves toSome(job)(Taken::Known) or clears (None), whilelisted()waits onLANDEDfor bothNonereservations and publishedSome(job)entries.Job::then'sOption<Vec<...>>withThen::{Pending, Done, Failed}so latejob.then(...)calls on a failedTaken::Knownjob also never fire.finish(jobs, ok): whenok == false, leavesstaging.uploaded = falseandstaging.dirty = true, setscopy.ahead = LISTED, decrementsBYTES, transitionsjob.thentoThen::Failedwithout running callbacks, removes jobs fromON_THEIR_WAY, notifiesLANDED, and skipsflip_now().Worker::allocator_in_flightacrossExecuteCommandLists->Signal->SetEventOnCompletion; if a failure happens afterExecuteCommandLists, retires the old allocator viacrate::host::retireand replaces it with a freshCreateCommandAllocatorbefore any subsequentReset().failed_finish_reverts_state_and_suppresses_callbacksandwait_known_waits_for_pending_reservation_to_clear.Rig Specs Tested On
x86_64)victory-gpucrate; full clippy & tests verified on GitHub Actionswindows-latestCI)x86_64) — Windowsx86_64-pc-windows-msvcCI verifies compilation, clippy, and unit testsRun Settings & Profile
origin/main(b0842d9)VICTORY_*Overrides: N/AMeasurements & Verification
cargo clippy --workspace --all-targets --locked -- -D warnings(verified on GitHub Actionswindows-latestCI)cargo clippy --workspace --all-targets --all-features --locked -- -D warnings(verified on GitHub Actionswindows-latestCI)cargo test --locked -p xtask-> 8 passed, 0 failedcargo xtask policy->asset policy: 324 files okcargo test -p victory-gpu --locked -- --test-threads=1(verified on GitHub Actionswindows-latestCI)