Memory: reject sparse and cross-window spans in texture::uma_bytes #1530

Open
github-bot wants to merge 1 commit from github-bot/gh-1530 into main AGit
Owner

@⁠OtavioTadeu on GitHub · 2026-11-24 17:18 UTC · original
OtavioTadeu:fix/uma-bytes-committed-span-1393 → main · +67 −7 · 2 files · 1 commits · open

Prevents texture::uma_bytes from reading uncommitted WindowKind::Sparse UMA reservations or cross-window spans, and returns an owned Vec<u8> instead of forging &'static [u8] over guest-mutable memory. Fixes #1393.

What is in it

  • crates/xcl/src/gpu/uma.rs: add Uma::contains_committed_span and unit tests covering sparse windows, cross-window spans, zero-length, and overflow
  • crates/xcl/src/gpu/texture.rs: validate spans via contains_committed_span, return Result<Vec<u8>, String> via uma_bytes_in, and add unit tests

Tested

  • NVIDIA GeForce GTX 1660 SUPER (driver 32.0.16.1088), AMD Ryzen 5 5600G, Windows 11 build 26200, DXC 1.9.2602.17 (Windows SDK 10.0.26100.0), rustc 1.100.0 (stable-x86_64-pc-windows-msvc), debug build
  • cargo test --workspace -- --test-threads=4: 778 passed, 0 failed, 41 ignored (SKIPPED GPU tests: gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask [no wave64], gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware [no wave64], heap_window_out_of_memory_falls_back_to_the_switch_form [no heap windows])
  • cargo test -p xcl --lib uma: 12 passed, 0 failed
  • cargo test -p xcl --lib texture: 31 passed, 0 failed

Regression run

  • scripts/smoke.ps1 -Game retail_title -Seconds 60 (main baseline vs PR head on NVIDIA GeForce GTX 1660 SUPER):

xcl-smoke v1

commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485

gpu: NVIDIA GeForce GTX 1660 SUPER

title: retail_title

seconds: 60

exit: 0x0

frames shown: 631 (PresentX 631)

presents per 2 s (last 3): 47 47 49

device removals: 0

crashes: 0

peak commit: 15199 MB


xcl-smoke v1

commit: 3cf8012435545c359e5806910f48f210abb9d716

gpu: NVIDIA GeForce GTX 1660 SUPER

title: retail_title

seconds: 60

exit: 0x0

frames shown: 637 (PresentX 638)

presents per 2 s (last 3): 41 40 40

device removals: 0

crashes: 0

peak commit: 15194 MB

Not tested

  • AMD / native wave64 GPUs, Linux/Wine, and extended gameplay past the 60 s smoke window

AI use

  • Antigravity with Gemini 4 Neon: analyzed the issue, wrote the fix, tests, and PR description; reviewed by author.
**@⁠OtavioTadeu** on GitHub · 2026-11-24 17:18 UTC · [original](https://github.com/xcl-dev/xcl/pull/1530) `OtavioTadeu:fix/uma-bytes-committed-span-1393` → `main` · +67 −7 · 2 files · 1 commits · open Prevents `texture::uma_bytes` from reading uncommitted `WindowKind::Sparse` UMA reservations or cross-window spans, and returns an owned `Vec<u8>` instead of forging `&'static [u8]` over guest-mutable memory. Fixes #1393. **What is in it** - `crates/xcl/src/gpu/uma.rs`: add `Uma::contains_committed_span` and unit tests covering sparse windows, cross-window spans, zero-length, and overflow - `crates/xcl/src/gpu/texture.rs`: validate spans via `contains_committed_span`, return `Result<Vec<u8>, String>` via `uma_bytes_in`, and add unit tests **Tested** - NVIDIA GeForce GTX 1660 SUPER (driver 32.0.16.1088), AMD Ryzen 5 5600G, Windows 11 build 26200, DXC 1.9.2602.17 (Windows SDK 10.0.26100.0), rustc 1.100.0 (`stable-x86_64-pc-windows-msvc`), debug build - `cargo test --workspace -- --test-threads=4`: 778 passed, 0 failed, 41 ignored (SKIPPED GPU tests: `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask` [no wave64], `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware` [no wave64], `heap_window_out_of_memory_falls_back_to_the_switch_form` [no heap windows]) - `cargo test -p xcl --lib uma`: 12 passed, 0 failed - `cargo test -p xcl --lib texture`: 31 passed, 0 failed **Regression run** - `scripts/smoke.ps1 -Game retail_title -Seconds 60` (`main` baseline vs PR head on NVIDIA GeForce GTX 1660 SUPER): ``` xcl-smoke v1 commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485 gpu: NVIDIA GeForce GTX 1660 SUPER title: retail_title seconds: 60 exit: 0x0 frames shown: 631 (PresentX 631) presents per 2 s (last 3): 47 47 49 device removals: 0 crashes: 0 peak commit: 15199 MB ``` ``` xcl-smoke v1 commit: 3cf8012435545c359e5806910f48f210abb9d716 gpu: NVIDIA GeForce GTX 1660 SUPER title: retail_title seconds: 60 exit: 0x0 frames shown: 637 (PresentX 638) presents per 2 s (last 3): 41 40 40 device removals: 0 crashes: 0 peak commit: 15194 MB ``` **Not tested** - AMD / native wave64 GPUs, Linux/Wine, and extended gameplay past the 60 s smoke window **AI use** - Antigravity with Gemini 4 Neon: analyzed the issue, wrote the fix, tests, and PR description; reviewed by author.
Adds Uma::contains_committed_span so texture::uma_bytes validates that the entire byte range lies within a single committed UMA window (rejecting uncommitted WindowKind::Sparse reservations and cross-window gaps) and returns an owned Vec<u8> instead of forging &'static [u8] over guest-mutable memory.

Fixes #1393.
Verified with cargo test -p xcl --lib uma (12 passed) and cargo test -p xcl --lib texture (31 passed).

Assisted-by: Antigravity (Gemini 4 Neon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:56:37 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 19:05 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 19:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/1530#issuecomment-7141591896) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~21 ignored. Thanks!
This pull request has changes conflicting with the target branch.
  • crates/xcl/src/gpu/uma.rs
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.
git fetch -u origin '+refs/pull/1530/head:github-bot/gh-1530'
git switch 'github-bot/gh-1530'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1530'
git switch 'github-bot/gh-1530'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1530'
git switch 'github-bot/gh-1530'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1530'
git switch 'main'
git merge --squash 'github-bot/gh-1530'
git switch 'main'
git merge --ff-only 'github-bot/gh-1530'
git switch 'main'
git merge 'github-bot/gh-1530'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.