descriptor/host.rs: FLIPS and NEW_PENDING keyed by HostHeap address; a heap at a reused address can read freed memory #232
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX#232
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@kekonn on GitHub · 2026-11-26 12:11 UTC · original
crates/victory-gpu/src/descriptor/host.rskeys pending slot flips and pending new textures bystd::ptr::from_ref(self) as usize(lines 2388, 2416, 2435, 3364, 3386).texture_slots_flipdrains only entries whosef.heap == ownand keeps every other entry for good (~2435-2438).Drop for Heap(descriptor.rs~834-841) removes the heap only fromSHADER_HEAPS, andHostHeaphas noDrop. If a shader-visible heap is freed while a flip is pending, and a new heap later lands at the same address, the new heap's texture pass treats the old flip as its own. It then evaluatesrecord_key(f.handle)(~2462) on the old heap's handle, a read of freed memory (or an access violation if a large heap's pages were released).When: the default path (
VICTORY_SHOW_NEW_LATERis on), but it needs a heap freed mid-flip and then its address reused. Console titles normally keep their shader-visible heap for the whole run, so this is rare and has not been seen. Without address reuse the entries just stay forever (small).Sketch (~18 lines): give
HostHeapa uniqueid(from a staticAtomicU64) and key on it instead of the address. Optionally addimpl Drop for HostHeapthat purges itsFLIPSandNEW_PENDINGentries.Upstream: #72 turns
HostHeapintoArc<HeapInner>with its ownidandDrop, but does not re-key these. This fix should come after #72, or reuse its id. #142 carries an older copy of the same code.Generated by Claude Code