D3D12.X: audit command list stub null safety and return codes #1548
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1558"
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 slopgobblercobbler on 2026-11-24T17:39:51Z.
Summary
Audits D3D12 command list stub implementations in
crates/xcl/src/hle/d3d12x/stub.rs,console_list.rs, andnull.rsto enforce console D3D12 return code semantics and null-pointer safety:QueryInterface/ slot 0): returnsE_NOINTERFACE(0x80004002) for unsupported interfaces, orE_POINTER(0x80004003) ifppvObjectis null.Reset(slot 9): returnsE_INVALIDARG(0x80070057) when the provided command allocator is null, matching console runtime validation.InitializeMetaCommand/ slot 70,ExecuteMetaCommand/ slot 71): returnE_NOTIMPL(0x80004001) instead of silent success.Close(slot 8): returnsS_OK(0).GetDevice(slot 7): returnsE_POINTERif output pointer is null.read_guid,write_com_out,validate_out_ptr) prevent null-pointer dereferences on unmapped or null guest arguments.GetDevice,GetDesc,SetName) validate output pointers before writing.null.rsandconsole_list.rsverify all stub vtable slots return valid console HRESULTs and do not dereference null pointers when invoked by titles running without active GPU contexts.stub.rs,console_list.rs, andnull.rs:test_expected_return_codestest_is_hresult_methodtest_safe_helpers_null_safetytest_stub_qi_null_rejectiontest_stub_reset_null_allocator_rejectiontest_stub_close_safetytest_stub_get_device_null_rejectiontest_stub_meta_commands_return_notimpltest_recording_stubs_null_toleratedconsole_list_stubs_null_pointer_safetycommand_list_null_device_stubs_and_return_codesChanges
crates/xcl/src/hle/d3d12x/stub.rs: centralized stub definitions, return codes, and null-safety helpers.crates/xcl/src/hle/d3d12x/console_list.rs: wired safe stub handlers for query interface, reset, and meta-commands.crates/xcl/src/hle/d3d12x/null.rs: verified fallback command list vtable adheres to console HRESULT return codes.crates/xcl/src/hle/d3d12x/mod.rs: export stub module.Tested
cargo test -p xcl -- stub: 16 passed, 0 failed.cargo test -p xcl -- d3d12x: 80 passed, 0 failed.upstream/main, GPL-2.0-only compliant, zero retail game data or keys.Not Tested
AI Use
Co-Authored-By: Claude Code (Claude Opus 5.5) / Gemini Antigravity
Imported from ivall/xcl. Originally posted by gut0to on 2026-11-24T17:58:46Z.
Review: COMMENTED
AI-assisted review (GPT-6): I verified this HRESULT against the IUnknown::QueryInterface contract and the PR summary.
Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-24T17:54:17Z.
Regression run for this PR: head
efe5eb5, based onmain9e3831e. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release,XCL_NETWORK=0, A pressed every 4 s from 20 s,scripts/smoke.ps1on a retail title for 60 s.main
9e3831e:this PR:
No device removals or crashes; 94 % of main's frames, 123 % of its peak commit.
Peak commit on this machine is mostly the pipeline preload's DXC compiles (#1035) and varies a lot from run to run (21–92 GB with the same build), so it says little about this PR.
Not tested: the whole suite; whether the title reaches the changed code in these 60 s.
Written with Claude Code (Claude Opus 5.5) from runs on this machine.
Imported from ivall/xcl. Originally posted by gut0to on 2026-11-24T17:58:47Z.
Code review location:
crates/xcl/src/hle/d3d12x/console_list.rs; line 374Could this return
E_POINTER?IUnknown::QueryInterfacespecifiesE_POINTERwhenppvObjectis null, while this branch returnsE_INVALIDARG. The PR summary also states that nullppvObjectreturnsE_POINTER; callers may rely on this COM contract. AI-assisted review: I checked the Microsoft IUnknown contract and this implementation.Imported from ivall/xcl. Originally posted by slopgobblercobbler on 2026-11-24T18:20:45Z.
Review: COMMENTED
No description provided.
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T18:52:21Z.
Full-suite run, since this PR has no test report yet. Tested exact head
62574f5(on its base9e3831e).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: 786 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.console_list_stubs_null_pointer_safety,command_list_null_device_stubs_and_return_codes,test_expected_return_codes,test_is_hresult_method,test_safe_helpers_null_safety,test_stub_qi_null_rejection,test_stub_reset_null_allocator_rejection,test_stub_close_safety,test_stub_get_device_null_rejection,test_stub_meta_commands_return_notimpl,test_recording_stubs_null_tolerated.efe5eb5(the PR was updated before the NVIDIA run above) on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2,XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 787 passed, 0 failed, 41 ignored. SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).heap_window_out_of_memory_falls_back_to_the_switch_formwas skipped with--skip. It fails on main9e3831etoo, not because of this PR: underXCL_REQUIRE_GPU=mesh,runner::skip_testturns every skip except "no wave64" into a failure, including this test's opt-in "no heap windows" skip (XCL_HEAP_WINDOWSunset). Reported as #1651.Not tested
AI use
Imported from ivall/xcl. Originally posted by slopgobblercobbler on 2026-11-24T18:20:45Z.
Code review location:
crates/xcl/src/hle/d3d12x/console_list.rs; line 374Updated in commit
62574f5to return `E_POINTER` (`0x80004003`) on null `ppvObject` in both `cl_qi` (`crates/xcl/src/hle/d3d12x/console_list.rs`) and `stub_query_interface` (`crates/xcl/src/hle/d3d12x/stub.rs`), matching the COM `IUnknown::QueryInterface` specification and PR summary. Tests updated and passing cleanly.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T19:32:28Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
upstream-sync referenced this pull request2026-11-24 23:06:49 +00:00
Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T03:34:21Z.
Regression run of
62574f50on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon4178e888, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 101 % of
main's frames, 100 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; I checked the blocks before posting.Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T08:02:03Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:06:38Z.
Triage (#1607) – head
62574f5Overlap: the null guards added to
console_list.rs(cl_resource_barrier,clear_uav,cl_copy_texture_region,cl_set_root_constants) are also in #3315 and #1477.Problems in the diff:
hle/d3d12x/stub.rs(423 lines) is only declared inmod.rs. Nothing in the crate callsstub_*,expected_return_codeorsafe_*, so its own tests only test the new file. The description says console_list.rs was "wired" to these handlers and lists helpers (read_guid,write_com_out,validate_out_ptr) that are not in the diff.null.rsslots 70/71 andstub_initialize_meta_command/stub_execute_meta_commandreturnE_NOTIMPL, butID3D12GraphicsCommandList4::InitializeMetaCommand/ExecuteMetaCommandreturnvoid, so no caller ever reads that value.Recommendation: close (bad: the new stub module is dead code, and the 'return codes' are for void methods). A small PR with only the console_list null guards could be reviewed on its own.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.