Repository navigation
D3D12.X: guard truncated, null, and unreadable mesh pipeline streams - #2015
GustavoEllwanger wants to merge 1 commit into
Conversation
|
Code review on
Remaining before merge:
|
|
Thanks for the review @raylitebull!
|
|
NVIDIA test of Setup: Windows: Windows 11 Pro 26300, RTX 5070 Ti 16 GB (driver 621.24), Ryzen 7 9800X3D, 32 GB RAM, rustc 1.99.1, release. Linux: Fedora 44, Wine 11.21 Staging, vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch, RTX 4070 12 GB (driver 615.71.09); release, cross-compiled to Regression run ( Windows (the run of Linux, the same two commits ( Tested
Read
Not tested: a truncated stream or an unreadable shader in a title run; the tests, and the title past the start screen, on Windows; the rest of the suite; AMD and Intel; past 100 s. AI use: Claude Code (Claude Fable 5.2) read the diff, built the trees, ran the title, the regression pairs and the tests, and wrote this comment. Posted without review by a person: the account owner was away and reads replies later. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Huge thanks @Royalflamejlh and @DavidM1911 for running the NVIDIA and retail smoke verifications on I've added the paired Regarding the logging question at |
Related to #1968 and #1833 (hardens the mesh pipeline stream path audited for #1968; does not claim to resolve the unconfirmed
ntdll.dll+0x1ff2acrash from #1968's local build).What is in it
Fixes three concrete memory-safety / panic gaps in the
CreatePipelineStatemesh-stream path (crates/xcl/src/hle/d3d12x/real.rs), plus unit and GPU integration tests that run on any D3D12 adapter (AMD, NVIDIA, Intel, or WARP):own_stream: checkreadable(desc, 16)before dereferencingdesc; checkat + psize <= sizebefore indexing subobject payloads (previously panicked on truncated tail subobjects); clear zero-length shader entries and returnNonewhen a non-null, non-empty shader pointer is unreadable instead of handing a dangling title pointer to the background PSO worker.finish_two_pass: checkppv.is_null() || (*ppv).is_null()right afterfinish_psosucceeds, returningE_INVALIDARGbefore compiling the compute pass or dereferencing*ppvduring error cleanup / registration.dev_create_pipeline_state: guard the directfinish_psofallback withstream_has_unreadable_shader(desc)so a stream carrying an unreadable shader bytecode pointer returnsE_INVALIDARGinstead of access-violating (0xC0000005) insideD3D12Core.dll.mesh_stream_testsinreal.rsandcrates/xcl/tests/d3d12_mesh_stream.rs): cover null/truncated/unreadable streams inown_stream, null out-pointer handling infinish_two_pass, console MS in the AS slot (E_INVALIDARG), console MS + AS together, malformed/unreadable streams throughID3D12Device2::CreatePipelineState, and 5-thread concurrent stream refusals.Regression run
Paired 60 s retail-title runs on Windows 11 Pro 26300 / NVIDIA GeForce RTX 5070 Ti (driver 621.24, release build) contributed by @Royalflamejlh in #2015 (comment):
Tested
cargo test -p xcl --lib mesh_stream_tests -- --nocapture: 2 passed, 0 failed, 0 ignored.cargo test -p xcl --test d3d12_mesh_stream -- --nocapture: 3 passed, 0 failed, 0 ignored (RX 7600).XCL_ADAPTER=warp cargo test -p xcl --test d3d12_mesh_stream -- --nocapture: 3 passed, 0 failed, 0 ignored (WARP).XCL_HEAP_WINDOWS=1 cargo test -p xcl --test gpu_compute_e2e heap_window_out_of_memory_falls_back_to_the_switch_form -- --nocapture: 1 passed, 0 failed (RX 7600).cargo test --workspace --no-fail-fast -- --test-threads=4 --skip fuzz_validate_and_gpu_1: 997 passed, 0 failed, 45 ignored, 1 filtered out, 0 wave64/mesh capability skips (8SKIPPEDlines: 6 per-lane#1426refusals, 1 driver cache / no Windows Developer Mode, 1no heap windowsverified separately above).XCL_ADAPTER=warp cargo test -p xcl --lib fuzz_validate_and_gpu_1 -- --nocapture: 1 passed (validated 500/500 modules500..1000,GPU-compared 0).git diff --check: passed.1633vs1633frames on Windows,1363vs1575frames on Linux, 0 crashes / 0 device removals).XCL_PSO_PRELOAD=0,Aat 16 s): 0 failed pipelines / 0 faults / 0 device removals.--lib mesh_stream_tests2 passed,--test d3d12_mesh_stream3 passed.cargo test -p xcl --lib(merged with currentmain): all passed, 0 failed (~26 ignored).Not tested
XCL_SAMPLE_*game-data tests, or a retail title actually triggering a truncated stream / unreadable shader at runtime.AI use
Written and verified with Antigravity (Gemini 4 Neon); all AMD RX 7600 and WARP builds and tests were run locally on this machine. NVIDIA / retail smoke runs were contributed by @Royalflamejlh and @DavidM1911 as linked above.