gpu: fix alias liveness check, Memory::heaps drop eviction, and stream Bytecode UB #693
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!693
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-693"
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?
@mint17 on GitHub · 2026-11-28 03:36 UTC · original
mint17:fix/gpu-alias-liveness-heap-evict-stream-ub→main· +312 −26 · 5 files · 1 commits · merged 2026-11-29 08:16 UTCAddresses three correctness and memory-safety issues in
crates/victory-gpu(zero conflict with #646 or #666):Changes
object.rs,resource.rs):object::is_alive(this)(refs.load(Ordering::Acquire) > 0) and updatesresource::is_aliasedfromalias_with(this, |_| ()).is_some()toalias_with(this, crate::object::is_alive).unwrap_or(false)so a dying target withrefs == 0still registered inTARGETS_ATbeforeResource::dropcompletes is not treated as an active alias.object::add_ref_alivewithchecked_add(1)to preventu32::MAXwrap-around.Memory::heapsentry onHeap::drop(adapted fromMarvisak#2234—memory.rs,descriptor.rs):memory::release_heap(key: usize)matchingMemory::heaps'sHostHeappointer key and calls it inDrop for Heapstrictly after dropping theSHADER_HEAPSwrite guard.Bytecoderead & truncated subobject guard (adapted fromMarvisak#2301—pipeline.rs):&*desc.stream.add(at + 8).cast::<Bytecode>()with.read_unaligned()and bounds-checks every subobject withsaturating_sub/checked_addbefore reading payload or callinggraphics.read.Verification
cargo test --locked -p victory-gpu --lib -- add_ref_alive is_alive alias safety_tests -- --test-threads=1(6 passed, 0 failed) and--features diagnostics(5 passed, 0 failed):object::tests::add_ref_alive_and_is_alive_check_refcount_boundsresource::tests::an_alias_source_is_held_after_the_title_releases_it(un-gated to#[cfg(windows)]with RAII cleanup)resource::tests::is_aliased_ignores_dying_target_with_zero_refcountdescriptor::safety_tests::released_view_heap_evicts_memory_heap_entry(RAII-guarded)pipeline::safety_tests::unaligned_stream_yields_its_shaders&truncated_shader_subobject_does_not_read_past_stream(RAII-guarded)--all-features) andcargo test --locked -p xtaskpassed (6 passed, 0 failed, including asset policy).@Dukestar69 on GitHub · 2026-11-28 04:48 UTC · original · approved these changes
LGTM — verified on Windows (RTX 5090):
cargo test -p victory-gpu --lib memory::(2/2),object::(5/5, includingadd_ref_alive_and_is_alive_check_refcount_bounds), andpipeline::tests::(2/2) all passedcargo xtask policypassed (294 files ok)Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).