DirectStorage: validate request sizes before allocation #1775
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1785"
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 ivall/xcl. Originally posted by yaxis1 on 2026-11-24T20:37:27Z.
Summary
E_OUTOFMEMORY.Tested
git diff --checkpassed.Not tested
(error 4551).
AI use
AI assistance was used to implement and review these changes.
Imported from ivall/xcl. Originally posted by frenziedcoder on 2026-11-24T20:55:45Z.
NVIDIA test report for
73a6454: the description has no test run (Application Control), so here is one. Full suite green, the PR's own test passing, and a clean smoke pair (1654 vs 1654 frames).Tested
stable-x86_64-pc-windows-msvc, DXC 1.8.2502.11 (SDK 10.0.26100.0). Exact head73a645459971606375a9f8191771253039a49aa7, no local changes.cargo build --workspace && cargo test --workspace -- --test-threads=4(debug): 864 passed, 0 failed, 42 ignored; all 18hle::dstorage::testspass. SKIPPED:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).Regression run (
scripts/smoke.ps1 -Seconds 60, release, the retail title of #505 at its start screen;XCL_PSO_PRELOAD=0for both builds, because this machine's preload list holds the program of #1307)base (
4178e88, this PR's base; the same base run as in my report on #1747):this PR:
Not tested: the world load (where this title's DirectStorage traffic is: thousands of requests per 2 s with BCPack) on this head, so the change is not exercised on retail requests beyond the start screen; AMD; Wine.
AI use: Claude Code (Claude Opus 5.5) built and ran the tests and smoke runs on my machine and wrote this report; I checked it.
Imported from ivall/xcl. Originally posted by LocranKing on 2026-11-24T22:24:17Z.
Independent Windows 11 + 8 GB Ampere (RTX 3060 Ti)
--releaseverification of exact head73a645459971606375a9f8191771253039a49aa7(merge-base6c89285): full suite green (including the new DirectStorage allocation test) and clean 60 s retail smoke.Tested
26200, AMD Ryzen 5 5500, 31.8 GB RAM, NVIDIA GeForce RTX 3060 Ti (8024 MiB VRAM, Ampere, wave32 only), driver32.0.16.2101(621.01),rustc 1.100.0 (0ef1bc386 2026-11-09)(x86_64-pc-windows-msvc), DXC1.9.2602.17 (21d28f72),--release.cargo build --release -p xcl: exit0.cargo test --workspace --release --no-fail-fast -- --test-threads=4 --nocapture): 864 passed, 0 failed, 42 ignored. Allhle::dstorage::testsandhle::bcpack::testspass, including the newhle::dstorage::tests::zeroed_buffer_rejects_impossible_allocation. Expected hostSKIPPEDlines:2wave64 (gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware),2D3D12 debug layer (test_title_draws_with_a_root_signature_under_the_debug_layer,uploads_start_from_each_subresources_state),1heap windows (heap_window_out_of_memory_falls_back_to_the_switch_form).Regression run (
scripts/smoke.ps1 -Seconds 60,--release)Reference
main(4178e88; exact merge-base6c89285was not smoked separately):PR
#1785(73a6454):Not tested: exact merge-base
6c89285smoke, AMD/Intel GPUs, D3D12 debug layer, or extended world streaming past 60 s.AI use: Antigravity (
Gemini 4 Neon) built and ran the--releasetest suite and 60 s smoke locally and drafted this report from the captured outputs.Imported from ivall/xcl. Originally posted by throny on 2026-11-25T00:27:01Z.
Two contributors checked independently and found that #1381 #1438 solves the same problem (for #1392) in a different way: #1607, group D54. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.
This is a hint from the community triage in #1607, not a maintainer decision.
AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T03:21:22Z.
PR #1785 - DirectStorage request-size validation
Tested commit
73a645459971606375a9f8191771253039a49aa7(clean detached checkout).Environment STOR-WINLAB, Windows 11 Enterprise Evaluation build 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB (driver 32.0.101.9175, wave range 8-32, DoublePrecisionFloatShaderOps=0). DXC/DXIL 1.9.2609.5, rustc 1.100.0 (0ef1bc386 2026-11-09). Used unoptimized dev/test profiles with debug info disabled and selected the A770. The D3D12 SDK debug layer was unavailable.
Tested
cargo build --workspaceandcargo test --workspace --no-runboth succeeded outside the GPU lock.cargo test -p xcl hle::dstorage::tests -- --nocapturereported 18 passed, 0 failed, 0 ignored, with zero explicit skips. The new test verifies that an impossible buffer reservation returns E_OUTOFMEMORY. Existing tests passed for zlib output sizing, BC1 queue decoding, and error recording on a request past EOF. The PR caps source, destination and intermediate sizes at 256 MiB each and checks the file range before allocating.cargo test --workspace --no-fail-fast -- --test-threads=4ran once under the shared Arc lock. The 20 target summaries total 846 passed, 18 failed, 42 ignored (exit 101). All 18 DirectStorage tests passed again. The pass total includes 3 explicit SKIPPED lines (two no wave64, one no heap windows). Those paths provide no coverage.Failures The library had 13 compute pipeline creation failures (0x80070057, including FP64 cases) and four output mismatches (FMA overflow control, pixel sampling with implicit LOD, f16 high-half preservation, and wave64 pixel reductions). The end-to-end test title failed its RSSetDepthBiasX dynamic depth-bias check (blue pixel, expected green).
Not tested A main baseline or retail-title smoke comparison, other GPU adapters, retail sample inputs (XCL_SAMPLE_* unset), request sizes at and above the 256 MiB boundary, and real memory pressure.
T3 Code / Codex (
gpt-6.2-sol,reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity,gemini-4-neon) verified counts againstpr1785-suite.logand published this report.Imported from ivall/xcl. Originally posted by CalvyPZ on 2026-11-25T22:39:07Z.
This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T10:48:06Z.
Review: COMMENTED
On
73a645459971606375a9f8191771253039a49aa7, the zlib-only path still has an infallible allocation after the new fallible buffers:zeroed_buffer(stage1_len)?allocates the intermediate size, thend.truncate(written)retains only that capacity, andd.resize(n, 0)can grow it todestination_sizewithout returningE_OUTOFMEMORY.Request::checkpermitssource_size < intermediate_size <= destination_sizeup to 256 MiB, so a small valid zlib stream with a 1 KiB intermediate size and a 256 MiB destination reaches this growth. If that reserve fails,Vec::resizecannot propagate the request error that this PR aims to provide. Could the padding path calltry_reserve_exact(n - d.len()).map_err(|_| E_OUTOFMEMORY)?beforeresize, with a focused failure-path check? I verified the path from source and the size constraints; I did not induce a real OOM.AI use: OpenAI Codex (GPT-6.2 Sol) found and checked the path; OpenAI Codex (GPT-6.2 Astra) independently verified it and wrote this review.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:47:02Z.
Triage (#1607) – head
73a6454Overlaps #1381 and #1438 (same issue). It makes the same
bcpack::decodeoutput buffer fallible as #1381, which has tests. It adds the same file-length check and fallible source buffers indstorage::executeas #1438, which also checks physical-page ranges. It adds a 256 MiB request cap, thevictoryrecord buffer and the zlib output buffer.Problems:
Request::checksays the cap keeps requests "within the existing 256 MiB limit", but main and this PR's base have no such limit. It is a new cap that fails any larger request with E_OUTOFMEMORY. Thelet mut recordsline invictory.rsis unindented. The only test coverszeroed_buffer(usize::MAX). It conflicts with main (executenow takesdest_on_stack/file_input).Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.