startup: check that refused storage requests leave the destination and later requests intact #1657
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1664"
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 RenzoWit35 on 2026-11-24T16:42:14Z.
Change
Adds
startup_storage_refusal_order, a device-free test of the DirectStorage stand-in (src/startup_stubs/xcrdapi.cpp), registered likestartup_storage_alloc_failure. Test-only: no change insrc/.It writes its own file (patterned raw bytes, then one stored-deflate zlib stream) and submits one batch of 8 requests, each followed by its status entry and an
EnqueueSignalfence:Every destination (4096 bytes) is poisoned with 0xA5 and compared over its whole length. The test also checks that each fence runs after its own status entry and before the next, in queue order, and that the stand-in's log names
read failedfor each refusal.docs/startup-runtime.mdgets one bullet.No per-file offset and no compressed-size fallback is added (as asked on #1586).
Verification
Commit under test: this commit on top of origin/main
c864f138. Windows 11 26300, MSVC 14.51.cmake --preset dev; cmake --build --preset dev --target startup_storage_refusal_order startup_storage_file_range startup_storage_alloc_failure startup_storage_worker_start startup_storage_root_check startup_dstorage_file_read_check startup_inflate_statusctest --preset dev -R "startup_storage|startup_dstorage|startup_inflate" --no-tests=error: 9/9 passed, 0 skipped (77), includingstartup_storage_refusal_order.--preset release: 9/9 passed, 0 skipped.Negative controls (run on the earlier base
734217e3; single-point edits ofxcrdapi.cpp, rebuilt, reverted, not committed):if (failed && self && strcmp(outcome, "read failed"))): fails, "request 1 status is E_FAIL, got 0x00000000" (also requests 2, 5, 6, and the fence checks).result = self->pending): fails, "request 3 status is S_OK, got 0x80004005" (the valid request after a refusal), likewise 4 and 7.Evidence and follow-up
Refs #1586. Relates to #1198 (the same request shapes: offset at EOF, implausible size). Existing coverage left as is:
startup_storage_file_range(helper level), the file-source negatives instartup_stub_consumer.cpp, the failure-order tests instartup_storage_alloc_failure.cpp. Open PRs #1429, #1390, #1616, #1622 and #1523 do not add a test of this shape.Not shown: that the title proceeds correctly after a refusal, and anything about the offset shift itself. A refusal happens in two layers (the bound check in
read_storage_fileand the read), so the test pins the observable behaviour, not which layer refuses.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T16:55:10Z.
Review: COMMENTED
Independent technical peer review of PR #1664 at head commit
a19dc4a3aaf4c8171427643c4c82a3c70976763a.Summary
CMakeLists.txt,docs/startup-runtime.md,tests/startup_storage_refusal_order.cpp). Zero production code is modified.Findings
tests/startup_storage_refusal_order.cpp):plan[4]andplan[7]share the exact same(zlib=true, offset=zlib_offset, size=stream.size())tuple, sooutcome_of(which scanslog_textfrom offset0) returns the log line fromplan[4]for bothi=4andi=7.outcome_ofsearches for'\r'as the line terminator, assuming CRLF output fromX2W_TRAP_LOG.Verification Executed Locally
git diff --check origin/main...HEAD— passed./root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py— passed (16 Markdown files, 350 links)./root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py— passed (1278 files).x2w_pipe.py win2025 --batch 1667 1664:--preset dev):startup_storage_refusal_order1/1 passed (0.03s)./O2(--preset release):startup_storage_refusal_order1/1 passed (0.03s).DirectStorage refusal orderentry indocs/startup-runtime.mdand rantests/docs_links_check.py— failed as expected withdocs/startup-runtime.md:513: nonexistent_target.md(exit=1), then restored viagit checkout -- .. (The C++ test itself is Win32-only and was verified on Windows Server 2025 Debug and Release/O2.)AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T17:28:26Z.
Built and ran this at
a19dc4a3. It passes here, and I checked that the layer under it is not hollow.Environment: Windows 11 build 26300.9974, MSVC 14.44.35207, SDK 10.0.26100.
Independent check on the boundary it leans on
The refusals here come from
read_storage_fileinsrc/startup_stubs/dstorage_file_read.h, so I mutated its three boundary comparisons and rebuiltXCRDAPI.dlleach time (timestamp checked):count > size - offset->>=(a read ending exactly at EOF refused)offset > size->>=(a read starting at EOF refused)ReadFileresultread == count->read > 0(short read accepted)So the "offset == end of file" case in the new fixture is doing real work, and the short-read case is guarded too.
What I think is still open
The fixture covers the ordering within one Submit on one queue. Two things it does not appear to touch, and both are the kind that a later refactor could break silently:
Neither is a defect in this change; they are the cases I would add next if you want this fixture to be the one that guards the ordering contract. I can write either against your branch or as a follow-up with
Refs #1664.One wording point
The header comment says the check covers "the whole poisoned buffer of each refused destination". Reading the test, the poisoned region checked is the destination buffer of each refused request, which is what matters — if the intent is the whole capacity including the bytes past the declared size, that is not asserted. Worth a half-sentence either way, because "whole buffer" is the kind of phrase someone will later trust without reading the code.
Verdict
Reviewed
a19dc4a3. Correct as written, the ordering assertions are real, and the helpers underneath hold their boundaries on three independent mutations.