Repository navigation
D3D12.X: guard null and unreadable pointers in graphics and compute PSO hooks - #2297
GustavoEllwanger wants to merge 1 commit into
Conversation
|
Regression run of Against the limits in CONTRIBUTING.md: 100 % of AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, AI use: Claude Code (Claude Opus 5.5) built both trees and ran |
5f0547e to
5f084cc
Compare
|
Thanks @Toons29 for the earlier RX 9070 smoke run on |
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
…#2296, xcl-dev#2297, xcl-dev#2320, xcl-dev#2323, xcl-dev#2329, xcl-dev#2333 Integrates shader heap-base addresses (xcl-dev#1803), fenced superseded texture unmaps (xcl-dev#2270), cross-queue VRAM heap reclamation fencing (xcl-dev#2275, using create_raw_fence under Wine), PcCall frame clamping and orphan PSO drop (xcl-dev#2296), PSO pointer guards (xcl-dev#2297), KickoffX idle spare list switching (xcl-dev#2320, preserving UnadoptGuard), console-list descriptor heap binding (xcl-dev#2323), ClearUnorderedAccessView PC handles (xcl-dev#2329), and dispatch_chain PSO retention (xcl-dev#2333).
|
Thanks @futurepro62 for running the full RTX 5070 Ti + AMD RDNA2 iGPU verification on |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
5f084cc to
56994d2
Compare
|
Thanks @DavidM1911 for the RTX 3060 Ti run! The intermittent I pushed a small cleanup, squashed into the same commit. The new head is
No behaviour change from @Toons29, since the head changed again, could you rerun the paired |
…1946, xcl-dev#1803, xcl-dev#2297, xcl-dev#2320, xcl-dev#2333 Carries forward still-open high-value upstream PRs onto upstream/main (2898511) + our updated Wine PR stack (xcl-dev#867, xcl-dev#1395-successor, xcl-dev#871, xcl-dev#877, xcl-dev#1732). Preserves UnadoptGuard in xcl-dev#2320 KickoffX reset_one. Assisted-by: Antigravity (Gemini 4 Neon)
56994d2 to
0b638b2
Compare
…1946, xcl-dev#1803, xcl-dev#2297, xcl-dev#2320, xcl-dev#2333 Carries forward still-open high-value upstream PRs onto upstream/main (2898511) + our updated Wine PR stack (xcl-dev#867, xcl-dev#1395-successor, xcl-dev#871, xcl-dev#877, xcl-dev#1732). Preserves UnadoptGuard in xcl-dev#2320 KickoffX reset_one. Assisted-by: Antigravity (Gemini 4 Neon)
bmjask
left a comment
There was a problem hiding this comment.
P1: unreadable_bytecode/unreadable_cached_pso return false for pointer=NULL,length>0, so invalid descriptor pairs bypass validation. Console translation can then replace an invalid shader/CachedPSO with valid/default data: e.g. valid console CS/VS plus CachedPSO={NULL,64} can succeed rather than E_INVALIDARG; optional PS {NULL,nonzero} can be silently dropped. Require pointer/length consistency (p==0 iff n==0), reject mismatches, and add integration tests for null/nonzero CachedPSO and optional shader fields.
|
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
Thanks! — Devin |
…SO hooks Co-Authored-By: Claude Opus 5.5 <[email protected]>
0b638b2 to
739407b
Compare
|
Thanks @bmjask for catching the P1 pointer/length mismatch gap! Updated \ix/d3d12x-pso-pointer-guards\ (rebased onto \main\ \�49be183, new head \739407b6):
|
Follow-up to #2015 for the graphics and compute PSO hooks (
CreateGraphicsPipelineState/CreateComputePipelineState).What is in it
crates/xcl/src/hle/d3d12x/real.rs:read_cstr_checked(1024-byte cap), pointer/length consistency & readability checksinvalid_bytecode/invalid_cached_pso(enforcingp == 0iffn == 0, plus readability when non-empty), validatedinput_layout_slice, andgraphics_desc_has_unreadable_pointers/compute_desc_has_unreadable_pointers.VS/PS/DS/HS/GS/CS), invalid/unreadableCachedPSO(including{NULL, nonzero}and{non-null, 0}mismatches), invalid/unreadableInputLayout(includingpInputElementDescs == NULLwithNumElements > 0, overflowingNumElements, and unreadable/unterminatedSemanticName), and invalid/unreadableStreamOutputpointers ingraphics_psoanddev_create_compute_psowithE_INVALIDARGinstead of crashing insideD3D12Coreor silently dropping/overwriting invalid fields during console translation.own_shader,own_compute,own_graphics,graphics_blob_key, and frame-trace layout logging against nullSemanticName(CStr::from_ptr(null)), inconsistent/unreadable shaders orCachedPSO, and invalid/overflowingInputLayout.bytecode(&[])returnsD3D12_SHADER_BYTECODE::default()({NULL, 0}) instead of a dangling non-null pointer with length 0.*ppvdereferences incompute_container,translated_compute_pso_once(includingdispatch_chainanddred::label), andtranslated_graphics_pso_oncewith!ppv.is_null() && !(*ppv).is_null()(validppPipelineState == NULLprobes returnS_FALSE).hle::d3d12x::real::pso_pointer_guard_tests.crates/xcl/src/hle/d3d12x/device_x.rs: usesreal::read_cstr_checkedinstead of rawCStr::from_ptrinnote_base.crates/xcl/tests/d3d12_pso_guards.rs: standalone integration tests (no game data, no vendor-specific skips) reproducing nullSemanticName, unreadable/overflowingInputLayout, cross-page unterminatedSemanticName, unreadable shader/CachedPSO/StreamOutputpointers, unreadable top-level desc pointers via raw COM vtable calls, and{NULL, nonzero}/{non-null, 0}mismatches onCachedPSO, optional shader stages (PS/DS/HS/GS),VS/CS,InputLayout, andStreamOutput.Tested
1.95.0 (59807616e 2026-04-14), DXC1.8.2502.11, debug build.32.0.16.1088)32.0.21042.62)origin/mainb49be183(head739407b6).cargo test -p xcl --test d3d12_pso_guards -- --test-threads=1on RTX 5060):graphics_and_compute_pso_unreadable_shader_and_desc_pointers_return_invalidargandgraphics_pso_null_semantic_name_does_not_crashcrashed with0xc0000005(STATUS_ACCESS_VIOLATION).739407b6:cargo test -p xcl --lib hle::d3d12x::real::pso_pointer_guard_tests: 2 passed, 0 failed, 0 ignored.XCL_ADAPTER=5060 cargo test -p xcl --test d3d12_pso_guards --test d3d12_mesh_stream -- --test-threads=1(NVIDIA RTX 5060):d3d12_pso_guards4 passed,d3d12_mesh_stream3 passed (0 failed, 0 ignored, 0 skipped).XCL_ADAPTER=Radeon cargo test -p xcl --test d3d12_pso_guards --test d3d12_mesh_stream -- --test-threads=1(AMD Radeon RDNA2):d3d12_pso_guards4 passed,d3d12_mesh_stream3 passed (0 failed, 0 ignored, 0 skipped).739407b6(XCL_ADAPTER=5060 cargo test --workspace -- --test-threads=4, NVIDIA RTX 5060): 1441 passed, 0 failed, 47 ignored (29 pre-existing runtimeSKIPPEDlines on wave32 NVIDIA / without D3D12 debug layer / Developer Mode / heap windows).Not tested
scripts/smoke.ps1) on the updated head739407b6: I do not have a retail title package on this machine (@Toons29 ran a clean 60 s RX 9070 pair on the earlier head5f0547ein comment, before rebasing and addressing the P1 review feedback). Any community tester with a retail title who can run pairedscripts/smoke.ps1blocks againstb49be183and739407b6is welcome to post them.AI use
crates/xcl/src/hle/d3d12x/for pointer/bounds safety bugs, implemented the guards inreal.rsanddevice_x.rs, addressed @bmjask's P1 pointer/length-consistency review, wrote the unit and integration tests, rebased ontob49be183, and ran the dual-GPU and workspace test suites.