gpu: fix aliased texture UAF, null CBV, heap eviction, split slot leak, and stream UB #291
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/TaynanGT--Vice-Tay!291
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-291"
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-27 13:51 UTC · original
mint17:fix/gpu-resource-lifetime-and-ub→main· +395 −18 · 10 files · 1 commits · openPorts five missing upstream correctness and memory-safety fixes into
crates/victory-gpu, adapted for Vice-Tay's architecture (zero merge conflict with #234, #245, or #272):Fixes Included
texture::alias(adapted fromfxceless#1336):object::add_ref_alive/is_aliveandresource::Held(Dropreleasing viaobject::release_boxed::<Resource>) soresource::alias_ofpins the target whilecrate::texture::aliascopies from it (updating bothdraw.rsandexternal.rsRecording::prepare_input).resource::has_aliasfor boolean-only checks inresource::hosted(which holdsr.host.made) andtexture/ahead.rs, avoiding anr.host.made -> TEXTURESAB-BA deadlock and refcount churn.Marvisak#2449):descriptor::create_cbvto recordView::Constant(0, 0)whendescis null instead of returning early and leaving a stale view active.address == 0 || size == 0inHostHeap::make_twinnedandState::tablesbeforeshadow::find/scratch_held/defer_constantsso null CBVs flow cleanly intonull_for+clear_twinwithout allocating a 4 MiB loose shadow at VA0x0or copying from a null pointer.Memory::heapsentry onHeap::drop(adapted fromMarvisak#2234):memory::release_heap(key: usize)matching Vice-Tay'sHostHeappointer key inMemory::heapsand calls it inDrop for Heapafter releasingSHADER_HEAPS.queue::submit_split(adapted fromfxceless#1320):crate::list::tables_done(&lists[..cut])immediately after synchronoushost.execute(&now)(matchingsubmit_cut).Bytecoderead and guard truncated subobjects (adapted fromMarvisak#2301):&*desc.stream.add(at + 8).cast::<Bytecode>()with.read_unaligned()and bounds-checks every subobject withsaturating_sub/checked_addbefore reading payload or callinggraphics.read.(Note:
object::add_ref_aliveandresource::Helduse the same placement and semantics as #257 so both PRs reconcile cleanly regardless of merge order.)Verification
cargo test --locked -p victory-gpu --lib -- add_ref_alive_rejects_zero_refcount an_alias_source_is_held_after_the_title_releases_it alias_after_title_upload_copies_the_gpu_atlas safety_tests -- --test-threads=1(7 passed, 0 failed — default and--features diagnostics, rebased on877a40e).an_alias_source_is_held_after_the_title_releases_it,null_cbv_make_at_does_not_allocate_shadow_and_clears_kept, andreleased_view_heap_evicts_memory_heap_entry, plus CPU tests foradd_ref_alive/is_alive,null_cbv_clears_a_stale_view,unaligned_stream_yields_its_shaders, andtruncated_shader_subobject_does_not_read_past_stream.cargo clippy -p victory-gpu --all-targets --locked -- -D warnings(default +--all-features) andcargo test --locked -p xtask(11 passed, 0 failed).@TaynanGT on GitHub · 2026-11-27 14:11 UTC · original
@mint17 The targeted tests and four CI checks on
4718827cover the five fixes well. The split between the owning alias lookup and the boolean check matters for lock ordering. I’ll carry that distinction through when reconciling the shared lifetime code with #257.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.