startup: check the memory SRV report fields #1506

Manually merged
github merged 1 commit from gh-pr/1506/head into gh-pr/1506/base 2026-11-26 23:12:35 +00:00
Owner

@⁠Asimmimx on GitHub · 2026-11-24 13:16 UTC · original
Asimmimx:startup/memory-srv-report-check → main · +65 −1 · 2 files · 1 commits · merged 2026-11-24 13:30 UTC

Change

Refs #1149. Follow-up to #1420. This adds four cases to startup_memory_srv_report, the device-free check of src/startup_stubs/memory_srv_report.h. That header formats the log line log_refused_memory_srv writes when device slot 70 refuses a memory SRV.

Two tests reach the header today:

  • startup_memory_srv_report builds lines by hand;
  • startup_address_srv_warp matches five log lines by regex. In its lines the 2D view fields are all zero, and the address and destination match any hex value.

So the view fields and the 64-bit values in the line were not checked exactly. 9 of 11 single-point mutants left both tests passing (table below), among them every 32-bit truncation of the address, the destination, the resource width and the buffer's first element. A refused call can carry 64-bit guest addresses and sizes, so a truncated value in this diagnostic would point at the wrong memory.

The new hand-worked lines:

Case What it pins
2D-array view with a distinct value in each field and clamp 2.25 field order: FirstArraySlice versus ArraySize, mip fields
R8 2D view: mostmip 1, mips 2, plane 3, clamp 1.5, address 0x200001000, destination 0x123456780 2D field order, fractional clamp, 64-bit address and destination
cube-array view, dimension 10 all six raw words (raw=00000001,00000002,00000006,00000002,3f000000,00000000) and no acceleration-structure note
buffer with width 0x100001000 and first element 0x100000008 64-bit width and first element

The change touches only tests/startup_memory_srv_report_check.cpp, which adds cases and changes no existing case, and two sentences in the "Buffer memory SRVs (device slot 70)" section of docs/startup-runtime.md. There is no CMake change.

Verification

Commit 3c6273ac (main) plus this change, dev preset (Debug), Windows 11 Pro build 26300.9974, MSVC 19.51.36260, Windows SDK 10.0.26100.0, WARP 10.0.26100.9818.

ctest --preset dev --no-tests=error -R '^(startup_memory_srv_report|startup_address_srv_warp)$' -V
#   2/2 passed; startup_memory_srv_report prints "slot 70 refusal lines: 8 lines and a truncation exact"

tests/docs_links_check.py, tests/bidi_controls_check.py and git diff --check passed.

Mutation probe

I applied each mutation to the header alone, rebuilt startup_memory_srv_report_check, startup_stream_consumer and d3d12_xs_shim, ran both tests, then reverted. None of this is committed.

Mutant Existing two With the new cases
control: reason= label renamed killed killed
dest_in_view_heap and address_readable swapped killed killed
2D view: MostDetailedMip and PlaneSlice swapped survived killed
2D view: clamp cut to an integer survived killed
2D-array view: FirstArraySlice and ArraySize swapped survived killed
raw words: only the first 8 bytes copied survived killed
acceleration-structure note on every unnamed dimension survived killed
buffer FirstElement cut to 32 bits survived killed
resource Width cut to 32 bits survived killed
address cut to 32 bits survived killed
destination cut to 32 bits survived killed

The head >= size truncation guard in report_view is not pinned. The real caller always passes a 256-byte buffer, so the guard cannot be reached from it, and a > mutant behaves the same.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code).

**@⁠Asimmimx** on GitHub · 2026-11-24 13:16 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1506) `Asimmimx:startup/memory-srv-report-check` → `main` · +65 −1 · 2 files · 1 commits · merged 2026-11-24 13:30 UTC ## Change Refs #1149. Follow-up to #1420. This adds four cases to `startup_memory_srv_report`, the device-free check of `src/startup_stubs/memory_srv_report.h`. That header formats the log line `log_refused_memory_srv` writes when device slot 70 refuses a memory SRV. Two tests reach the header today: - `startup_memory_srv_report` builds lines by hand; - `startup_address_srv_warp` matches five log lines by regex. In its lines the 2D view fields are all zero, and the address and destination match any hex value. So the view fields and the 64-bit values in the line were not checked exactly. 9 of 11 single-point mutants left both tests passing (table below), among them every 32-bit truncation of the address, the destination, the resource width and the buffer's first element. A refused call can carry 64-bit guest addresses and sizes, so a truncated value in this diagnostic would point at the wrong memory. The new hand-worked lines: | Case | What it pins | |---|---| | 2D-array view with a distinct value in each field and clamp 2.25 | field order: FirstArraySlice versus ArraySize, mip fields | | R8 2D view: mostmip 1, mips 2, plane 3, clamp 1.5, address `0x200001000`, destination `0x123456780` | 2D field order, fractional clamp, 64-bit address and destination | | cube-array view, dimension 10 | all six raw words (`raw=00000001,00000002,00000006,00000002,3f000000,00000000`) and no acceleration-structure note | | buffer with width `0x100001000` and first element `0x100000008` | 64-bit width and first element | The change touches only `tests/startup_memory_srv_report_check.cpp`, which adds cases and changes no existing case, and two sentences in the "Buffer memory SRVs (device slot 70)" section of `docs/startup-runtime.md`. There is no CMake change. ## Verification Commit `3c6273ac` (`main`) plus this change, `dev` preset (Debug), Windows 11 Pro build 26300.9974, MSVC 19.51.36260, Windows SDK 10.0.26100.0, WARP 10.0.26100.9818. ```powershell ctest --preset dev --no-tests=error -R '^(startup_memory_srv_report|startup_address_srv_warp)$' -V # 2/2 passed; startup_memory_srv_report prints "slot 70 refusal lines: 8 lines and a truncation exact" ``` `tests/docs_links_check.py`, `tests/bidi_controls_check.py` and `git diff --check` passed. ## Mutation probe I applied each mutation to the header alone, rebuilt `startup_memory_srv_report_check`, `startup_stream_consumer` and `d3d12_xs_shim`, ran both tests, then reverted. None of this is committed. | Mutant | Existing two | With the new cases | |---|---|---| | control: `reason=` label renamed | killed | killed | | `dest_in_view_heap` and `address_readable` swapped | killed | killed | | 2D view: MostDetailedMip and PlaneSlice swapped | **survived** | killed | | 2D view: clamp cut to an integer | **survived** | killed | | 2D-array view: FirstArraySlice and ArraySize swapped | **survived** | killed | | raw words: only the first 8 bytes copied | **survived** | killed | | acceleration-structure note on every unnamed dimension | **survived** | killed | | buffer FirstElement cut to 32 bits | **survived** | killed | | resource Width cut to 32 bits | **survived** | killed | | address cut to 32 bits | **survived** | killed | | destination cut to 32 bits | **survived** | killed | The `head >= size` truncation guard in `report_view` is not pinned. The real caller always passes a 256-byte buffer, so the guard cannot be reached from it, and a `>` mutant behaves the same. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Claude Code).
src/startup_stubs/memory_srv_report.h formats the line logged for a
refused device slot 70 call. startup_memory_srv_report compared it for
an acceleration-structure, a buffer and a 2D-array view, but never for
a plain 2D view, and its array view used the same value for several
fields. startup_address_srv_warp matches the 2D view only with zero
fields and accepts any hex address and destination. Nine single-point
mutants left both tests passing: mip and plane swapped in the 2D view,
its clamp cut to an integer, first slice and count swapped in the array
view, only the first qword of an unnamed view copied, the
acceleration-structure note added to every unnamed dimension, and the
buffer width, first element, address and destination cut to 32 bits.

Add four lines to the existing check: an array view and a 2D view with
a distinct value in each field and a fractional clamp, a cube-array
view printed as raw words without the note, and a buffer wider than
4 GiB with a first element past 2^32. The 2D case uses an address and
a destination above 4 GiB. Each of the nine mutants now fails the
check. A renamed reason label and the two flags swapped were already
caught by both tests.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:12:33 +00:00
github manually merged commit 0ae499c73e into gh-pr/1506/base 2026-11-26 23:12:35 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 13:31 UTC · original · reviewed

Reviewed 0ae499c73e32d74d215eabd5095c9a248f654ff2:

  • Change: tests/startup_memory_srv_report_check.cpp adds four exact-line cases checking src/startup_stubs/memory_srv_report.h: distinct 2D-array view fields, 2D view with distinct mip/plane/fractional clamp and >4 GiB dest/address, cube-array raw 6-word dump (without the acceleration-structure note), and >4 GiB Width / FirstElement on a raw buffer view. docs/startup-runtime.md documents the expanded check. Verified expected strings against report_resource, report_view, and report_refused_memory_srv in src/startup_stubs/memory_srv_report.h.
  • Linux checks: git diff --check origin/main..HEAD, python3 tests/docs_links_check.py (334 links across 16 files), and python3 tests/bidi_controls_check.py (1223 files) all passed.
  • Win2025 verification (Windows Server 2025 Build 26100, MSVC 14.44.35207):
    • Debug (--preset dev): startup_memory_srv_report_check built (3.73s); ctest --preset dev -R '^startup_memory_srv_report$' --parallel 4 --no-tests=error --output-on-failure — 1/1 passed (0.09s).
    • Release /O2 (--preset release): startup_memory_srv_report_check built (1.10s); same CTest filter — 1/1 passed (0.08s).

Looks good to me.

**@⁠tedin7** on GitHub · 2026-11-24 13:31 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1506#pullrequestreview-6040077589) · **reviewed** Reviewed `0ae499c73e32d74d215eabd5095c9a248f654ff2`: - **Change**: `tests/startup_memory_srv_report_check.cpp` adds four exact-line cases checking `src/startup_stubs/memory_srv_report.h`: distinct 2D-array view fields, 2D view with distinct mip/plane/fractional clamp and >4 GiB `dest`/`address`, cube-array raw 6-word dump (without the acceleration-structure note), and >4 GiB `Width` / `FirstElement` on a raw buffer view. `docs/startup-runtime.md` documents the expanded check. Verified expected strings against `report_resource`, `report_view`, and `report_refused_memory_srv` in `src/startup_stubs/memory_srv_report.h`. - **Linux checks**: `git diff --check origin/main..HEAD`, `python3 tests/docs_links_check.py` (334 links across 16 files), and `python3 tests/bidi_controls_check.py` (1223 files) all passed. - **Win2025 verification** (Windows Server 2025 Build 26100, MSVC 14.44.35207): - **Debug (`--preset dev`)**: `startup_memory_srv_report_check` built (`3.73s`); `ctest --preset dev -R '^startup_memory_srv_report$' --parallel 4 --no-tests=error --output-on-failure` — **1/1 passed** (`0.09s`). - **Release `/O2` (`--preset release`)**: `startup_memory_srv_report_check` built (`1.10s`); same CTest filter — **1/1 passed** (`0.08s`). Looks good to me.
This discussion has been locked. Commenting is limited to contributors.
No description provided.