D3D12.X: a pipeline stream cut inside a subobject payload is not rewritten #1279
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1289"
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 emirduran707 on 2026-11-24T14:20:49Z.
Two walkers of a title's pipeline state stream (
D3D12_PIPELINE_STATE_STREAM_DESC) checked that a subobject's 8-byte header fits inSizeInBytes, but not that its payload does:fallback_stream(real.rs) rewrites a stream the PC driver refused. It writes into a buffer of exactlySizeInBytesbytes. For a stream cut inside its last subobject's payload, it panicked with a range error inside anextern "system"function, which aborts the title. Example: 16 bytes, a VS subobject with 8 of its 16-byteD3D12_SHADER_BYTECODE.capture_stream_desc(null.rs) read the 16 bytes of shader bytecode at the cut payload without checking them, an access violation when the stream ends at a page the process may not read.The sibling walkers
stream_subobjectsandknown_subobjectsalready bound the payload, andfallback_streamis documented to return None when it cannot rewrite. Both now stop at a payload that runs past the end:fallback_streamreturns None, so the title gets the driver's error, andcapture_stream_descstops the walk.What is in it
crates/xcl/src/hle/d3d12x/real.rs:fallback_stream;fallback_stream_tests::a_stream_ending_inside_a_payload_is_not_rewritten, which compiles its stand-in shaders with D3DCompile and uses no device. A cut stream gives None; a whole one is rewritten as before.crates/xcl/src/hle/d3d12x/null.rs:capture_stream_desc;a_stream_ending_inside_a_shader_payload_is_not_read_past_its_end, with a stream that ends at a page the process may not read.Tested
cargo test --workspace -- --test-threads=4on365d7c8: 743 passed, 0 failed, 41 ignored; no SKIPPED GPU testsbuf[at..at + 16]copy ("range end index 24 out of range for slice of length 16"); the null.rs test ends the test process withSTATUS_ACCESS_VIOLATION; with them both passRegression run
main:
this PR:
Not tested
own_stream(real.rs) indexes payloads the same way, but only afterstream_subobjectshas checked the stream; left as it is.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T14:33:24Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:Thanks!
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T14:38:31Z.
Full-suite run on NVIDIA and AMD to go with the subset check above. Tested exact head
365d7c8(on its base47efa2e).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 743 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.a_stream_ending_inside_a_shader_payload_is_not_read_past_its_end,a_stream_ending_inside_a_payload_is_not_rewritten.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 743 passed, 0 failed, 41 ignored, no skips.Not tested
AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T16:04:21Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib -- --test-threads=1: all passed, 0 failed, 21 ignored.Thanks!
upstream-sync referenced this pull request2026-11-24 23:06:49 +00:00
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T04:40:58Z.
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin