Repository navigation
D3D12.X: clamp root argument writes to the target parameter's size - #1319
Conversation
bind::put_in and console_list::close destructured Param::Constants without checking `count`, only bounds-checking against the entire root argument table. Writing constants with offset + n > count (or writing past a 4-byte table / 8-byte descriptor slot) silently overwrote the adjacent root parameter, and large offsets could overflow in bind.rs. Clamp writes to the parameter's own byte span using checked arithmetic in bind::put_in, and stop at `off + k >= count` in console_list::close, with a unit test verifying adjacent parameters are preserved. Assisted-by: OpenCode (Gemini 4 Neon)
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
…v#1305-xcl-dev#1379 Integrate 22 open upstream PRs targeting world rendering, shader correctness, DirectStorage terrain loads, and crash/memory stability: - xcl-dev#1321 (xcl-dev#1307): fall back to pc blocks when structured CFG HLSL grows oversized (eliminates the 148 MB HLSL / 1 GB/s commit explosion from b8b1f49 so XCL_PSO_PRELOAD=1 stays flat at ~5.4 GiB) - xcl-dev#549, xcl-dev#1312: DirectStorage late page-array queue hold (fixes 0x89240009 terrain read failures) and 0-byte memory-source requests - xcl-dev#1365 (xcl-dev#1361): GFX10.30 scratch SADDR 0x7F addresses the immediate offset alone instead of adding v0 - xcl-dev#1368: translated compute PSOs use NodeMask 0 - xcl-dev#1371 (xcl-dev#105): deduplicate packed ISG1 vertex input struct fields - xcl-dev#1375 (xcl-dev#1360): ES s_setpc_b64 ends block before gs_start - xcl-dev#1350, xcl-dev#1351, xcl-dev#1352, xcl-dev#1353, xcl-dev#1349: VS layer/viewport outputs, PS sample index/fixed-point position & SV_Coverage, depth+UAV initial states, console SetPredication - xcl-dev#1305, xcl-dev#1306, xcl-dev#1314, xcl-dev#1319, xcl-dev#1322, xcl-dev#1334, xcl-dev#1339, xcl-dev#1355, xcl-dev#1357, xcl-dev#1379: console_list UMA hold on Release, v_cmp_class_f32 bitwise abs/neg, late_release vram queue wait, root arg clamping, empty BVH / NaN rays, NULL IASetIndexBuffer clearing, MSAA MipLevels=1, VFS lazy-page commits, coherent VirtualFree validation, cpu_writes PAGE_GUARD & stale fence wakeups - README.md: document the integrated PRs, XCL_PSO_PRELOAD=1, and 16 GiB cap Verified on RX 9060 XT / GE-Proton11-14: release build clean, targeted unit tests pass (75 passed, 0 failed), and 80 s run with XCL_PSO_PRELOAD=1 and XCL_MEM_LIMIT=12G stays flat at 5340-5413 MB with 512+ pipelines preloaded (1385 frames, exit 0x0). Assisted-by: Antigravity (Google DeepMind)
…v#1305-xcl-dev#1379 Integrate 22 open upstream PRs targeting world rendering, shader correctness, DirectStorage terrain loads, and crash/memory stability: - xcl-dev#1321 (xcl-dev#1307): fall back to pc blocks when structured CFG HLSL grows oversized (eliminates the 148 MB HLSL / 1 GB/s commit explosion from b8b1f49 so XCL_PSO_PRELOAD=1 stays flat at ~5.4 GiB) - xcl-dev#549, xcl-dev#1312: DirectStorage late page-array queue hold (fixes 0x89240009 terrain read failures) and 0-byte memory-source requests - xcl-dev#1365 (xcl-dev#1361): GFX10.30 scratch SADDR 0x7F addresses the immediate offset alone instead of adding v0 - xcl-dev#1368: translated compute PSOs use NodeMask 0 - xcl-dev#1371 (xcl-dev#105): deduplicate packed ISG1 vertex input struct fields - xcl-dev#1375 (xcl-dev#1360): ES s_setpc_b64 ends block before gs_start - xcl-dev#1350, xcl-dev#1351, xcl-dev#1352, xcl-dev#1353, xcl-dev#1349: VS layer/viewport outputs, PS sample index/fixed-point position & SV_Coverage, depth+UAV initial states, console SetPredication - xcl-dev#1305, xcl-dev#1306, xcl-dev#1314, xcl-dev#1319, xcl-dev#1322, xcl-dev#1334, xcl-dev#1339, xcl-dev#1355, xcl-dev#1357, xcl-dev#1379: console_list UMA hold on Release, v_cmp_class_f32 bitwise abs/neg, late_release vram queue wait, root arg clamping, empty BVH / NaN rays, NULL IASetIndexBuffer clearing, MSAA MipLevels=1, VFS lazy-page commits, coherent VirtualFree validation, cpu_writes PAGE_GUARD & stale fence wakeups - README.md: document the integrated PRs, XCL_PSO_PRELOAD=1, and 16 GiB cap Verified on RX 9060 XT / GE-Proton11-14: release build clean, targeted unit tests pass (75 passed, 0 failed), and 80 s run with XCL_PSO_PRELOAD=1 and XCL_MEM_LIMIT=12G stays flat at 5340-5413 MB with 512+ pipelines preloaded (1385 frames, exit 0x0). Assisted-by: Antigravity (Google DeepMind)
|
Test report for head Tested
Not tested
AI use
|
|
AMD RDNA3 (native wave64) test report for exact head Tested
Not tested
AI use: Claude Code (Claude Sonnet 5.5) ran the build and tests and wrote this report; the numbers are from the runs above. |
|
Test report for The case. Tested
Not tested
AI use
|
|
merge-check |
|
merge-check claim |
|
merge-check |
|
merge-check |
|
Test report for What we tested
Effect, in our diagnostic tree (main af2cecc + local diagnostics + #1319's bind.rs change, identical lines), run r262 against run r261 without the change:
Main-based runs
Tested
Not tested
AI use
|
Keeps upstream's DXIL IR cuts (xcl-dev#3500-xcl-dev#3503/xcl-dev#3495-xcl-dev#3499: sampler waterfall, descriptor windows, split-wave64 mask exchange, per-lane exec, direct PS masks, quad shuffles, packed/normalized buffer decode, commit-aware compiles), xcl-dev#3269 fixed-point optimizer, xcl-dev#3154 compact compute prologue, xcl-dev#2123 split atomic add, xcl-dev#2070 offline 64 MB stacks, xcl-dev#3442 split-whole, xcl-dev#1319 root-constant bounds, xcl-dev#3356 late Reset releases, xcl-dev#1322 empty-BVH/NaN rays, xcl-dev#2753 3-D texture sizing, XMA/VFS/TLS/loader fixes. Resolutions: - real.rs: union of T-156 res_release pinning with upstream's InListReset and abi_rs_for_stages; dropped upstream's warm_graphics (T-095 removed that path); kept ComputeBuild::IndirectChain for our split-chain variant. - dispatch_chain.rs: kept our IndirectBuild split-chain architecture (the T-095 port removed the preload/whole-worker machinery upstream builds on); ported upstream's huge-PSO refusal log. - pso_async.rs: took upstream's commit-aware build_pieces/build_scoped and WORKER_STACK, removed the preload/backlog subsystem our port does not have (and its tests), kept our profile_is_series_s. - late_release.rs: took upstream's Dead enum, Busy/InListReset and hold_pipeline/hold_heap/hold_unmap, with our vram release path (no recycle pool). - emit.rs: upstream's additions moved into emit/memory.rs (ADD_TID_ENABLE), emit/exp.rs (misc-vector layer/viewport), emit/mimg.rs (SampleCmp with bias gradients), emit/valu.rs (abs/neg on shift/align), emit.rs out_struct. - bind.rs: root-constant bounds clamp + its test; kept our bool execute_indirect API. - bvh.rs: our grow/tri_ret/watertight model plus upstream's empty-root bounds and NaN-ray refusal. - kernel.rs: upstream's mask/waterfall/rodata cuts plus our lanes_upper. - shaders.rs: upstream's worker stack helpers and mesh/GS precompile paths, with our PipelineJob record identity. - eh.rs: upstream's CLWB TF guard + test, our termination test. - lower.rs test: 574bda4 makes wave32 SALU words compute S_WQM without quad lanes; assert that and keep the wave64 refusal.
bind::put_inandconsole_list::closedestructuredParam::Constantswithout checkingcount, only bounds-checking against the entire root argument buffer. Writing constants withoffset + n > count(or writing past a 4-byte table / 8-byte descriptor slot) silently overwrote the adjacent root parameter, and large offsets could overflow inbind::put_in.This clamps writes to each parameter's own byte span using checked arithmetic in
bind::put_inand stops atoff + k >= countinconsole_list::close(while still advancingat += 1 + npast the recorded command packet).What is in it
crates/xcl/src/hle/d3d12x/bind.rs: clamp writes input_into the target parameter's byte span with checked arithmetic; add unit testout_of_bounds_root_constants_do_not_clobber_adjacent_parameter(verified failing before the fix).crates/xcl/src/hle/d3d12x/console_list.rs: stop constant writes atoff + k >= countinclose.Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 752 passed, 0 failed, 41 ignored (SKIPPED GPU tests: 2no wave64—gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware)cargo test -p xcl --lib out_of_bounds_root_constants_do_not_clobber_adjacent_parameter: 1 passed, 0 failed (failed before the fix, overwriting adjacent descriptor bytes)Regression run
main:
PR:
Not tested
AI use
bind.rsandconsole_list.rs, wrote the fix and unit test, ran the test suite andscripts/smoke.ps1regression runs, and drafted this PR description.