DXIL assemble: guard null/empty DXC blobs, null COM interfaces, and 32-bit IR length #2587
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2587
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2587"
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?
@Decodere on GitHub · 2026-11-26 00:29 UTC · original
Decodere:fix-dxil-assemble-dxc-blob-null-safety→main· +116 −8 · 1 files · 1 commits · openFixes three DXC FFI safety bugs in
crates/xcl/src/gpu/recomp/dxil/assemble.rs: empty/null DXC blobslice::from_raw_partsUB inerrors()andassemble(), missing null COM interface pointer check inmake<T>(), and silent 32-bit IR length truncation viair.len() as u32. Part of #2413, Part of #1833, Part of #1269.What is in it
crates/xcl/src/gpu/recomp/dxil/assemble.rs(blob_bytes,errors,assemble): factorblob_bytes(ptr, len)returningOk(&[])whenlen == 0(never callingslice::from_raw_partson null),Err("null DXC blob buffer")whenptr.is_null() && len > 0, andOk(slice)otherwise; trim trailing\0bytes inerrors()and fall back to formatting the failedHRESULTwhen the error buffer is missing, empty, or whitespace-only; reject an empty validated container inassemble()with"assemble: empty DXIL container".crates/xcl/src/gpu/recomp/dxil/assemble.rs(make): checkif p.is_null()afterDxcCreateInstancereturnsS_OKbefore callingT::from_raw(p), returningErr("DxcCreateInstance: returned null interface").crates/xcl/src/gpu/recomp/dxil/assemble.rs(blob_len,assemble): validateir.len()withu32::try_from(len)instead of truncating viair.len() as u32before callingIDxcUtils::CreateBlob.crates/xcl/src/gpu/recomp/dxil/assemble.rs(mod tests): added 3 pure-CPU / mock-COM0-skip unit tests (blob_bytes_and_blob_len_validate_null_empty_and_bounds,make_rejects_null_interface_and_propagates_hresult, anderrors_handles_null_empty_blob_trims_nuls_and_falls_back_to_hresult) alongside preservedir_text_assembles_signs_and_runs.Tested
rustc 1.100.0, DXC1.9.2609.5,--release.08db8020:make_rejects_null_interface_and_propagates_hresultaborted with0xc000001d(STATUS_ILLEGAL_INSTRUCTION) insideIUnknown::from_raw(null)before the null-pointer guard was added.cargo test --release -p xcl --lib -- gpu::recomp::dxil::assemble::tests:: --nocapture:4 passed, 0 failed, 0 ignored,0skips on both RTX 4060 and WARP (XCL_ADAPTER=warp,XCL_WARP=1).cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture:37test binaries,1432 passed, 0 failed, 47 ignored(SKIPPED GPU/host tests: 29 pre-existing on 32-lane RTX 4060 without D3D12 debug layer — 21 no wave64, 3 per-lane wave32 refused, 3 no D3D12 debug layer, 1 no heap windows, 1 cannot disable driver cache; 0 skipped ingpu::recomp::dxil::assemble::tests).Regression run
main:
PR:
Not tested
CreateBloballocation (covered viablob_len((u32::MAX as usize) + 1)unit check).AI use
@futurepro62 on GitHub · 2026-11-26 00:41 UTC · original · edited 2026-11-26 00:43 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
534deb25(on its base08db802).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 1420 passed, 0 failed, 45 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,dispatch_chain_native_wave64_builds_whole,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.blob_bytes_and_blob_len_validate_null_empty_and_bounds,make_rejects_null_interface_and_propagates_hresult,errors_handles_null_empty_blob_trims_nuls_and_falls_back_to_hresult.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1431 passed, 0 failed, 47 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on main08db8020too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests,const_and_null_mask_operands_agree_with_hlsl_on_the_gpuandmask_ff0_and_flbit_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
@DarkPanda69 on GitHub · 2026-11-26 00:52 UTC · original
64-lane AMD run (listed as untested; the report above is NVIDIA): the 3 new tests pass, and nothing else changes in the GPU suite on an RX 9070 XT or an RTX 3060.
Head
534deb2applied onmainb49be18, debug, Windows 11 Pro 26200,cargo test -p xcl --lib -- gpu:: --test-threads=4onmainand with the PR, card chosen withXCL_ADAPTER:mainOn both cards, the only result changes against
mainare the newblob_bytes_and_blob_len_validate_null_empty_and_bounds,errors_handles_null_empty_blob_trims_nuls_and_falls_back_to_hresultandmake_rejects_null_interface_and_propagates_hresult, all ok, with no new skips. So the wave64 GPU tests that skip on a 32-lane GPU ran with this PR on the RX 9070 XT and still pass. The 2 RX 9070 XT failures are the AMD fuzz seeds tracked in #2115, the same onmain.Not tested: the D3D12 debug-layer tests (no
d3d12SDKLayers.dllhere either), Intel, a title.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
@DavidM1911 on GitHub · 2026-11-26 01:09 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 26 ignored.Thanks!
— Devin
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.