startup: check the logical view table bounds #1443
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1450"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-24T11:45:43Z.
Change
Refs #1149. This adds a device-free check for
src/startup_stubs/logical_view_table.h. The header decides which part of the title's descriptor memory a translated draw may read through a root table handle.list_table(list slot 36) callsresolve_view_table, and the SRV gather callsViewTable::record, both ind3d12_draw.inl.No test currently checks these bounds where they apply:
startup_logical_view_<adapter>, returns 77 when the adapter accepts the full 1,245,184-descriptor heap. On this machine it skips on WARP 10.0.26100.9818 and on an AMD Radeon RX 6600 (driver 32.0.21045.29003), 3 of 3 runs each.startup_logical_view_tableincludes only the header and checks exact windows and records at the boundaries:UINT64_MAX(accepted) and one byte past it (rejected), and the full 64-bitcount * strideproduct;record()at a window's first and last records, records crossing the end, a record exactly at the end,UINT64_MAXoffset and size, and an unresolved table;The change is test, CMake and
docs/startup-runtime.mdonly. The header and the device code are unchanged.Verification
Commit
92bd3362(main) plus this change,devpreset (Debug), Windows 11 Pro build 26300.9974, MSVC 19.51.36260, Windows SDK 10.0.26100.0.tests/docs_links_check.pyandtests/bidi_controls_check.pypassed.Mutation probe
I applied each mutation to the header alone, rebuilt
startup_stream_consumer(and confirmed the DLL relinked), ran the tests, then reverted. None of this is committed. "Existing" means the 11 WARP tests driven bystartup_stream_consumer:^startup_(stream_request|stream_draw|mrt_.*|logical_view|xg_bc7_draw|slot57_blend_draw|packed_target_draw|address_srv|placed_vertex|address_bc_view)_warp$.startup_logical_view_tableoffset >= bytes→>offset % stridecpu > UINT64_MAX - bytesrecord:size <= bytes - offset→<record: returnaddressinstead ofaddress + offsethandle < gpubytesinstead ofbytes - offsetcount * strideA control mutant where the table never resolves made 4 of the 11 WARP tests fail (
xg_bc7_draw,packed_target_draw,address_srv,address_bc_view). So the harness does see this code; it does not check the bounds.Notes:
handle < gpucan only be told apart by a heap near the top of the address space, which is an artificial input.offset == bytes) is deliberately not pinned. Nothing reads such a record, and pinning it would freeze a choice that does not matter.Checklist
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T11:54:46Z.
Review: COMMENTED
Reviewed commit
1c3842a62ff140d904c48adb3997f48afa1272b0(git diff origin/main...HEAD). Clean, focused test + docs addition; no issues found.Checks
python3 tests/docs_links_check.py,python3 tests/bidi_controls_check.py, andgit diff --check origin/main..HEADpassed. Title-neutrality clean.--preset dev):startup_logical_view_table_checkbuilt (3.10s);ctest -R '^startup_logical_view_table$'1/1 passed (0.01s)./O2(--preset release): built (0.44s); 1/1 passed (0.01s).Audit
tests/startup_logical_view_table_check.cppdirectly exercisesx2w_startup::resolve_view_tableandViewTable::recordacross boundary cases (first/last records, 64-bitUINT_MAX * UINT_MAXproduct,UINT64_MAXaddress-space wraparound, unaligned/out-of-range handles, null/zero inputs, and out-of-bounds/overflowing record offsets and sizes) without modifyingsrc/startup_stubs/logical_view_table.h.docs/startup-runtime.mdaccurately documents the reproduction command and scope.