gpu: validate a raw SRV address against its buffer #1010

Closed
R0Y00 wants to merge 1 commit from upstream-pr/1017 into main
R0Y00 commented 2026-11-23 21:26:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T21:26:07Z.


Refs #874.

Resolve a raw buffer SRV from a GPU byte address inside an owned resource and a separate element offset. Reject misalignment, range overruns and empty views before a descriptor reaches the driver.

The self-built fixture dispatches through a descriptor table and reads 1024 words across a 64 KiB boundary. A second valid descriptor shifted by four elements must match its own expected contents and differ from all 1024 words in the original result.

Local measurement on Windows 11 build 26200, MSVC 19.51, Windows SDK 10.0.26100 DXC, RTX 4060 Laptop driver 32.0.16.1656 and WARP. Debug layer off for this public fixture. After building the C++ and HLSL, ran these from the build directory:

.\vm_copy_queue_check.exe raw_srv_hardware
.\vm_copy_queue_check.exe raw_srv_warp
.\vm_copy_queue_check.exe provenance_hardware
.\vm_copy_queue_check.exe provenance_warp
.\vm_copy_queue_check.exe hardware
.\vm_copy_queue_check.exe warp

All six exited 0, with no skips. The two new runs had zero mismatches in each correctly interpreted span and 1024/1024 differences with the displaced descriptor.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6569158763 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1017). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T21:26:07Z. --- Refs #874. Resolve a raw buffer SRV from a GPU byte address inside an owned resource and a separate element offset. Reject misalignment, range overruns and empty views before a descriptor reaches the driver. The self-built fixture dispatches through a descriptor table and reads 1024 words across a 64 KiB boundary. A second valid descriptor shifted by four elements must match its own expected contents and differ from all 1024 words in the original result. Local measurement on Windows 11 build 26200, MSVC 19.51, Windows SDK 10.0.26100 DXC, RTX 4060 Laptop driver 32.0.16.1656 and WARP. Debug layer off for this public fixture. After building the C++ and HLSL, ran these from the build directory: ```powershell .\vm_copy_queue_check.exe raw_srv_hardware .\vm_copy_queue_check.exe raw_srv_warp .\vm_copy_queue_check.exe provenance_hardware .\vm_copy_queue_check.exe provenance_warp .\vm_copy_queue_check.exe hardware .\vm_copy_queue_check.exe warp ``` All six exited 0, with no skips. The two new runs had zero mismatches in each correctly interpreted span and 1024/1024 differences with the displaced descriptor.
tedin7 commented 2026-11-24 06:45:52 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T03:27:44Z.

Review: COMMENTED


Reviewed 979c3697 (diff + Linux doc/bidi checks; Windows build/D3D12/WARP tests were not run locally).

Findings

No functional or AGENTS.md issues found in the diff:

  • src/raw_buffer_srv.h (make_raw_buffer_srv): validates non-null base, address >= base, address - base < width, non-zero count, 4-byte alignment of address - base, bounds against available_elements = (width - offset) / 4 without overflow on first_element * 4, and 16-byte alignment (D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT) on offset + first_element * 4.
  • tests/vm_copy_queue_check.cpp & tests/vm_raw_srv.hlsl: exercises 1024 words straddling a 64 KiB boundary, a 4-element-shifted second descriptor (verifying 0 mismatches on both spans and 1024/1024 differences against the unshifted span), and 3 negative E_INVALIDARG checks (misaligned start, out-of-range base address, count overrun).
  • CMakeLists.txt & docs/experiments.md: registers vm_raw_srv_{warp,hardware} with SKIP_RETURN_CODE 77 and documents the reproduction command; wording is title-neutral.

Checks run on Linux

  • python3 -B tests/docs_links_check.py: passed (13 Markdown files, 214 links).
  • python3 -B tests/bidi_controls_check.py: passed (845 tracked files).
  • Windows build and D3D12/WARP execution (vm_copy_queue_check / vm_raw_srv_*) were not run locally.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6033223253 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1017#pullrequestreview-6033223253). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T03:27:44Z. **Review:** COMMENTED --- Reviewed `979c3697` (diff + Linux doc/bidi checks; Windows build/D3D12/WARP tests were not run locally). ### Findings No functional or `AGENTS.md` issues found in the diff: - `src/raw_buffer_srv.h` (`make_raw_buffer_srv`): validates non-null `base`, `address >= base`, `address - base < width`, non-zero `count`, 4-byte alignment of `address - base`, bounds against `available_elements = (width - offset) / 4` without overflow on `first_element * 4`, and 16-byte alignment (`D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT`) on `offset + first_element * 4`. - `tests/vm_copy_queue_check.cpp` & `tests/vm_raw_srv.hlsl`: exercises 1024 words straddling a 64 KiB boundary, a 4-element-shifted second descriptor (verifying 0 mismatches on both spans and 1024/1024 differences against the unshifted span), and 3 negative `E_INVALIDARG` checks (misaligned start, out-of-range base address, count overrun). - `CMakeLists.txt` & `docs/experiments.md`: registers `vm_raw_srv_{warp,hardware}` with `SKIP_RETURN_CODE 77` and documents the reproduction command; wording is title-neutral. ### Checks run on Linux - `python3 -B tests/docs_links_check.py`: passed (13 Markdown files, 214 links). - `python3 -B tests/bidi_controls_check.py`: passed (845 tracked files). - Windows build and D3D12/WARP execution (`vm_copy_queue_check` / `vm_raw_srv_*`) were not run locally.
R0Y00 commented 2026-11-24 06:49:46 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T22:07:56Z.


Independent Intel validation is now available for this exact head 979c369: UHD Graphics 770, driver 32.0.101.7092, Windows 11 build 26300.10075, debug layer off. Both valid spans matched all 1,024 words, and the displaced descriptor differed in all 1,024. The same counts held on the rebased SRV prerequisite of #1025. Source-built Intel report

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7115364410 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1017#issuecomment-7115364410). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T22:07:56Z. --- Independent Intel validation is now available for this exact head `979c369`: UHD Graphics 770, driver 32.0.101.7092, Windows 11 build 26300.10075, debug layer off. Both valid spans matched all 1,024 words, and the displaced descriptor differed in all 1,024. The same counts held on the rebased SRV prerequisite of #1025. [Source-built Intel report](https://github.com/R0Y00/Xbox2Windows/issues/874#issuecomment-7115178745)
Toons29 commented 2026-11-24 06:50:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Toons29 on 2026-11-24T02:02:58Z.


Tested 979c3697 on an AMD Radeon RX 9070 (RDNA 4, 1002:7550), driver 32.0.32029.2010, Windows 11 build 26300, dev preset, debug layer unavailable: pass

ctest --preset dev --no-tests=error -R '^(vm_raw_srv_|vm_copy_queue_)' -V

All 4 pass with no skips. vm_raw_srv_hardware and _warp both report SRV cross-page mismatches=0 shifted mismatches=0 negative=1024/1024. vm_copy_queue_hardware and _warp both report copy queue early mismatches=0 ordered mismatches=0 early vs remapped=16384/16384.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119703681 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1017#issuecomment-7119703681). Originally posted by [Toons29](https://github.com/Toons29) on 2026-11-24T02:02:58Z. --- Tested 979c3697 on an AMD Radeon RX 9070 (RDNA 4, `1002:7550`), driver `32.0.32029.2010`, Windows 11 build 26300, `dev` preset, debug layer unavailable: pass ```powershell ctest --preset dev --no-tests=error -R '^(vm_raw_srv_|vm_copy_queue_)' -V ``` All 4 pass with no skips. `vm_raw_srv_hardware` and `_warp` both report `SRV cross-page mismatches=0 shifted mismatches=0 negative=1024/1024`. `vm_copy_queue_hardware` and `_warp` both report `copy queue early mismatches=0 ordered mismatches=0 early vs remapped=16384/16384`.
upstream-sync closed this pull request 2026-11-24 12:02:40 +00:00
R0Y00 commented 2026-11-24 12:03:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T11:25:17Z.


Closing the superseded branch. The raw SRV resolver, its 1,024-word cross-page and shifted-view controls, and the reproduction commands are already on main from #1025 (prerequisite commit ee730d22). The independent Intel and AMD reports above remain linked from this PR and #874.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7130074413 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1017#issuecomment-7130074413). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T11:25:17Z. --- Closing the superseded branch. The raw SRV resolver, its 1,024-word cross-page and shifted-view controls, and the reproduction commands are already on main from #1025 (prerequisite commit ee730d22). The independent Intel and AMD reports above remain linked from this PR and #874.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1010
No description provided.