D3D12.X: audit command list stub null safety and return codes #1558
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!1558
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@slopgobblercobbler on GitHub · 2026-11-24 17:39 UTC · original
slopgobblercobbler:fix/d3d12-commandlist-stub-safety→main· +518 −3 · 4 files · 1 commits · openSummary
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
@Anon64 on GitHub · 2026-11-24 17:54 UTC · original
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.
@futurepro62 on GitHub · 2026-11-24 18:52 UTC · original · edited 2026-11-24 18:53 UTC
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
@DavidM1911 on GitHub · 2026-11-24 19:32 UTC · original
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!
@Toons29 on GitHub · 2026-11-25 03:34 UTC · original
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.@gut0to on GitHub · 2026-11-24 17:58 UTC · original
On
crates/xcl/src/hle/d3d12x/console_list.rsline 374 (outdated):Could 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.@slopgobblercobbler on GitHub · 2026-11-24 18:20 UTC · original
On
crates/xcl/src/hle/d3d12x/console_list.rsline 374 (outdated):Updated 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.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.