Textures: safe texture::uma_bytes constructs &'static [u8] over uncommitted sparse UMA windows #1393
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl#1393
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?
@microwave805 on GitHub · 2026-11-24 15:31 UTC · original
Checked on
main(930e8b4).Problem
Safe
pub fn texture::uma_bytes(crates/xcl/src/gpu/texture.rs:123-132) constructs a&'static [u8]viastd::slice::from_raw_partsafter checking only!u.contains(a) || !u.contains(end - 1):Uma::contains(p)(crates/xcl/src/gpu/uma.rs:479-481) returnstruefor uncommittedWindowKind::Sparsewindows reserved only withMEM_RESERVE(uma.rs:174, 216). Reading the returned slice triggers an immediateSTATUS_ACCESS_VIOLATION.aandend - 1independently allows spans that start in one UMA window and end in another across uncommitted/unmapped gaps.&'static [u8]over guest-mutable UMA memory violates Rust's shared-reference immutability invariant (UB).(Note:
uma_bytescurrently has no internal callers incrates/xcl/src, so this is a latent soundness bug in a safe public API.)Suggested fix
Validate that the entire
[a, end)range is committed and readable within a single window (e.g., viashader::readable/VirtualQueryper page) and copy into an ownedVec<u8>instead of returning&'static [u8].AI use: Antigravity (Gemini 4 Neon) performed the read-only source audit and drafted this issue; checked and verified on
930e8b4before opening.