GPU: initialize title-memory page tables to null entries and guard range overflow #2542
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2544"
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 reeledMarek on 2026-11-25T15:33:48Z.
Problem
memory::Shared::new()allocated the upload buffer for a heap's title-memory page table without initializing level 1 and block 0 to[self.null, 0]. If a title bound title memory on a new heap and released the heap before submitting the list,memory::preparecould not runrewrite(), leaving shaders reading an all-zero page table that pointed to descriptor heap slot0instead ofself.null.memory::table()checkedstart + len > 1 << 40with unchecked addition, which panics in debug or wraps in release for overflowing ranges.Fix
table(&[], &[], null)inShared::new().start.checked_add(len)inmemory::table().Testing
overflowing_copy_ranges_are_ignored_and_empty_table_routes_to_nullincrates/victory-gpu/src/memory.rs.cargo test -p xtask --lockedpasses asset policy.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T18:35:11Z.
Automated triage for the maintainers.
Two changes in
victory-gpu/src/memory.rs:table()useschecked_add. The ranges come only fromShadow::range()of registered host copies (Shared::rewrite), sostart + lencannot overflow au64. This guards a case that can't happen, and the test only exercises it with made-up ranges. Please drop it unless you can show a caller that passes such a range.Shared::newfills the page table with null entries.bindcreates the table, and every submission that uses it runsprepare, which rewrites it (generationstarts atu64::MAX). So the zeroed table is only ever read if the title's heap has already been released when the list is submitted. That is invalid use of the heap anyway, and the null pair lives in that same heap. The fill is cheap and harmless, but it needs a concrete case where it changes behaviour: a log or a sequence of title calls showing a list submitted after its heap was released.With (1) removed and (2) motivated, this could go in as a small hardening change. CI checks: passing.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-25T20:05:39Z.
Closing per triage —
Shadow::range()cannot overflow andprepare()always populates the page table before valid use. Thanks for the review!Pull request closed