startup: check the memory SRV report fields #1499

Merged
Asimmimx merged 1 commit from upstream-pr/1506 into main 2026-11-24 13:30:58 +00:00
Asimmimx commented 2026-11-24 13:16:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-24T13:16:59Z.


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).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6582655150 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1506). Originally posted by [Asimmimx](https://github.com/Asimmimx) on 2026-11-24T13:16:59Z. --- ## 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).
upstream-sync closed this pull request 2026-11-24 14:03:01 +00:00
tedin7 commented 2026-11-24 14:03:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T13:31:29Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6040077589 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1506#pullrequestreview-6040077589). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T13:31:29Z. **Review:** COMMENTED --- 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.
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!1499
No description provided.