GPU: initialize title-memory page tables to null entries and guard range overflow #2544
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2544
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2544/head"
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?
@reeledMarek on GitHub · 2026-11-25 15:33 UTC · original
reeledMarek:fix/gpu-memory-table-init-and-overflow→main· +28 −3 · 1 files · 1 commits · closed without mergingProblem
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.@Marvisak on GitHub · 2026-11-25 18:35 UTC · original
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
@reeledMarek on GitHub · 2026-11-25 20:05 UTC · original
Closing per triage —
Shadow::range()cannot overflow andprepare()always populates the page table before valid use. Thanks for the review!Pull request closed