GPU: hold SHADER_HEAPS across descriptor mirror and check query offsets #52
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/52"
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 Marvisak/VIctory. Originally posted by AndyLatimer on 2026-11-23T23:52:40Z.
Fixes a concurrent lifetime bug in descriptor mirroring and three bounds/overflow edge cases in
victory-gpu:descriptor::mirrorconcurrentHeap::dropUAF (descriptor.rs):shader_slotpreviously lockedSHADER_HEAPS, dereferenced the raw*const Heapinto&Heap, and dropped theSHADER_HEAPSlock before returning tomirror. A concurrentHeap::dropon another thread could free the heap beforemirroraccessedheap.pending/heap.host.mirrornow holds theSHADER_HEAPSlock across the access (matchingrelease_dynamic's locking discipline;HostHeap::mirrornever locksSHADER_HEAPS).descriptor::copy_simpleandcreate_heapguards (descriptor.rs): returns early on an unknown descriptor heap kind instead of loopingcounttimes callingmirror(dst), and rejects placed heaps whoseaddress + sizeoverflowsu64.list::resolve_queriesoffset overflow (list.rs):offset + u64::from(count) * bytes > sizecould overflowu64(panic in debug builds, wrap in release into an out-of-bounds write). Now useschecked_addwith a regression test (resolve_queries_rejects_overflowing_offset).Testing
cargo test -p victory-gpu: 37 passed, 0 failed (including the newresolve_queries_rejects_overflowing_offsettest).cargo clippy -p victory-gpu --all-targets: 0 warnings.cargo xtask policy: pass (148 files).Imported from Marvisak/VIctory. Originally posted by lordon1a on 2026-11-24T00:19:57Z.
Verified
628b95da5on Windows 11 (x86_64-pc-windows-gnullvm,rustc 1.100.0, applied cleanly tomain@35b054ec0): pass.cargo xtask policy: 150 files okcargo test -p victory-gpu: 40 passed, 0 failed (including the new query offset / descriptor heap mirror test + host D3D12 tests).AI-assisted.
Imported from Marvisak/VIctory. Originally posted by DaviTostes on 2026-11-24T00:57:32Z.
Tested
628b95dunder Wine 11.22 + vkd3d-proton 3.1 on Arch Linux x86_64 (AMD RX 9060 XT, RADV 26.3.1), Windows build withcargo xwin ... --target x86_64-pc-windows-msvc: pass, no regression.victory_gpu: 35 passed, 2 failed — the PR adds one test, and the two failures are the environment-only ones present on this base (argument_clamp_builds,buffer_data_reaches_the_host_texture, the latter now tracked as #128).97c78d1; the pipeline-library test that fails on vkd3d only exists on newermain, so this run is otherwise clean.No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T10:11:38Z.
Review: APPROVED
Tested
628b95don Windows 11, RTX 5070, MSVC:cargo test -p victory-gpu37 passed, includingresolve_queries_rejects_overflowing_offset.cargo clippy -p victory-gpu --all-targetsis clean.mirrornow holdsSHADER_HEAPSand then takesheap.pending, andHeap::hosttakespendingwhile it builds or mirrors intoHostHeap. Neither of those paths takesSHADER_HEAPS(onlydrop,release_dynamicandcreate_heapdo, and they take nothing else first), so there is no inversion.copy_simplereturning early on an unknown kind is better than the old behaviour: withstep = 0, everymirror(dst)call hit the same handle.count * bytesinresolve_queriescannot overflow (u32 × at most 88 fits in u64), sochecked_addon the offset alone is enough.AI-assisted (Claude Code).