Tracking & Static Audit: 50 New Source-Level Bugs + 150 Prioritized Backlog Items [Part 1/3] #1488
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#1488
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@hyperland956-lgtm on GitHub · 2026-11-24 16:51 UTC · original
Tracking & Static Audit: 50 New Source-Level Bugs (D3D12.X Lifetime/Sync, Shader Recompiler, DirectStorage, XMA2, Tiling) + 150 Prioritized Backlog Items
Repository:
https://github.com/ivall/xclAudited Revision:
main (2026-11-24 snapshot)Date:
2026-11-241. Highest-Impact Active Bottlenecks (Existing Canonical Issues/PRs — Do Not Duplicate)
BCPack Zero-Byte Texture Fills (Black World) — Tracked in
#878(184 MB of BC1/BC3/BC5/BC6H/BC7 requests filling 0 bytes; prior PRs#905and#950closed unmerged).AS-Slot Mesh Pipeline Refusals (42 Pipelines) — Reported in
#534and#878.Commit Growth (~40 GB) & Late-Release Memory Retention — Reported in
#534; active work in#1040,#968, and #1070 (building on merged#866).DirectStorage Deferred Page-Array Safety — Tracked in
#476and open PR#509.2. Newly Identified, Non-Duplicate Findings (50 Separable Tasks)
Each item below was checked against all existing open, merged, and closed issues/PRs and comments, and can be implemented and tested in its own focused PR.
XCL-BT-001crates/xcl/src/hle/d3d12x/real.rslines2713-2731, 3007-3021XCL-BT-002crates/xcl/src/gpu/recomp/emit.rslines1704-1728, 3750-3769, 1495-1524XCL-BT-003crates/xcl/src/hle/d3d12x/cpu_writes.rslines56-104XCL-BT-004crates/xcl/src/hle/dstorage.rslines881-940XCL-BT-005crates/xcl/src/hle/d3d12x/device_x.rslines355-386, 446-500, 521-565XCL-BT-006crates/xcl/src/hle/dstorage.rslines615-627XCL-BT-007crates/xcl/src/hle/kernelx.rslines1222-1242XCL-BT-008crates/xcl/src/hle/d3d12x/pso_async.rs, crates/xcl/src/hle/d3d12x/real.rslinespso_async.rs:354-367, 376-394, 448-458; real.rs:1598-1606XCL-BT-009crates/xcl/src/hle/d3d12x/sparse.rslines587-601, 1355-1413, 1454-1456XCL-BT-010crates/xcl/src/gpu/recomp/emit.rslines1780, 1816XCL-BT-011crates/xcl/src/hle/kernelx.rslines1154-1199XCL-BT-012crates/xcl/src/gpu/recomp/emit.rslines1919-1985XCL-BT-013crates/xcl/src/hle/d3d12x/alloc_pool.rslines89-102, 195-216XCL-BT-014crates/xcl/src/gpu/tiling.rslines299-317XCL-BT-015crates/xcl/src/hle/xma2/mod.rslines69-94XCL-BT-016crates/xcl/src/hle/xma2/mod.rslines1764-1780XCL-BT-017crates/xcl/src/hle/xma2/mod.rslines1566-1582XCL-BT-018crates/xcl/src/hle/acphal.rslines711-717, 775, 927-953XCL-BT-019crates/xcl/src/hle/d3d12x/bind.rslines175-182, 235-261XCL-BT-020crates/xcl/src/gpu/recomp/emit.rslines1787-1805XCL-BT-021crates/xcl/src/gpu/bvh.rslines217-235XCL-BT-022crates/xcl/src/hle/d3d12x/console_list.rslines377-393XCL-BT-023crates/xcl/src/hle/d3d12x/real.rslines4660-4670XCL-BT-024crates/xcl/src/hle/d3d12x/list_x.rslines3155-3219, 3341-3360XCL-BT-025crates/xcl/src/gpu/recomp/emit.rslines5282-5284XCL-BT-026crates/xcl/src/gpu/recomp/emit.rslines5344-5358XCL-BT-027crates/xcl/src/hle/gameinput.rslines815-842XCL-BT-028crates/xcl/src/gpu/recomp/emit.rslines2217-2223, 2455-2459XCL-BT-029crates/xcl/src/hle/kernelx.rs, crates/xcl/src/hle/kernelx/lazy.rslineskernelx.rs:1169-1176; lazy.rs:47-59XCL-BT-030crates/xcl/src/hle/kernelx.rslines453-467XCL-BT-031crates/xcl/src/hle/d3d12x/list_x.rslines3738-3753XCL-BT-032crates/xcl/src/hle/d3d12x/list_x.rslines3486-3517XCL-BT-033crates/xcl/src/hle/d3d12x/sparse.rslines970-997, 1021-1038XCL-BT-034crates/xcl/src/hle/d3d12x/real.rslines4549-4577XCL-BT-035crates/xcl/src/hle/d3d12x/title_textures.rslines260-266, 426-451XCL-BT-036crates/xcl/src/hle/d3d12x/real.rslines4347-4414XCL-BT-037crates/xcl/src/gpu/recomp/upper_lanes.rslines549-555XCL-BT-038crates/xcl/src/gpu/recomp/emit.rslines3304-3308XCL-BT-039crates/xcl/src/gpu/recomp/emit.rslines2960-2965, 3186-3191XCL-BT-040crates/xcl/src/hle/xgameruntime/api.rslines366-379XCL-BT-041crates/xcl/src/hle/xgameruntime/mod.rslines867-871, 891-910XCL-BT-042crates/xcl/src/gpu/recomp/emit.rslines5008-5011, 5059XCL-BT-043crates/xcl/src/hle/acphal.rslines955-962, 985-994XCL-BT-044crates/xcl/src/hle/kernelx.rslines648-667XCL-BT-045crates/xcl/src/hle/d3d12x/present.rslines158-171XCL-BT-046crates/xcl/src/gpu/recomp/emit.rslines2564-2573, 3633-3638, 5851XCL-BT-047crates/xcl/src/gpu/recomp/emit.rslines3471-3472, 3547-3555, 5624XCL-BT-048crates/xcl/src/gpu/recomp/emit.rslines2025-2031XCL-BT-049crates/xcl/src/gpu/recomp/emit.rslines2987-2992, 3362-3375XCL-BT-050crates/xcl/src/hle/xgameruntime/networking.rslines421-442Technical Details for All Newly Identified Findings
1.
XCL-BT-001— HEAP_UMA Frees Backing Sparse/UMA Block Immediately on ID3D12Heap::Release While Placed Buffers Remain Alive (CPU Crash / GPU UAF) (P0)Location:
crates/xcl/src/hle/d3d12x/real.rslines2713-2731, 3007-3021Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records (issues_and_prs.json=1,035, pulls.json=849, issue_comments.json=3,395). Searched 'heap_uma', 'mem_heap_release', 'uma_buffers', 'create_placed_resource_x': only PR #40 (initial routing) and unrelated depth/format PRs (#163, #651, #1063) matched; zero issues or PRs cover premature HEAP_UMA deallocation on heap release.
Root Cause: In
dev_create_placed_resource_x(real.rs:2713-2731), buffers placed into aHEAP_UMAheap are backed byblock + offset(UMA_BUFFERS.insert(res, (va, bytes, false))) rather than being created inside the PCID3D12Heap, so the PC placed buffer holds no COM reference onheap. In D3D12, titles routinely release anID3D12Heapimmediately after creating placed resources from it (expecting the runtime to keep the heap alive until all placed resources are destroyed). Whenmem_heap_release(real.rs:3007-3021) observes the heap refcount drop to0, it immediately callssparse::free(p)oru.free(p)on the backing UMA/sparse block even though placedID3D12Resourcebuffers inside that block are still alive and referenced by CPU pointers and in-flight GPU command lists.Edge-Case / Verification Note: Checked whether placed buffers hold an explicit
AddRefonheapanywhere indev_create_placed_resource_xorres_release:UMA_BUFFERSstores only(va, bytes, owns_block: false)and never stores orAddRefs the parentheappointer. Thus releasingheapwhile any placed buffer is live unconditionally frees the underlying memory.Synthetic Reproducer: Create a buffer
ID3D12Heap(routed toHEAP_UMA), callCreatePlacedResourcefor a buffer at offset 0, callheap->Release()(valid D3D12 lifetime), then read/write the placed buffer's GPU VA or CPU UMA address in a subsequent draw/dispatch. Observe immediate access violation or GPU page fault / corrupted reads aftersparse::free(p)decommits or recycles the block.Proposed Fix & Risk: - Fix: Track the parent
heappointer (withAddRefon placement andReleaseinres_release) or reference-countHEAP_UMAbacking blocks viaArcshared between the heap entry and every placed buffer inUMA_BUFFERS, deferringsparse::free(p)/u.free(p)until both the heap and all placed buffers (and anylate_releaseGPU holds) have released.Regression Risk: Low; adds a lightweight
Arcor heapAddRef/Releasepair per placed buffer inHEAP_UMA, matching standard D3D12 placed-resource heap lifetime semantics. (Estimated size:M)2.
XCL-BT-002— MUBUF/MTBUF bounds checks ignore V# OOB_SELECT, omit SOFFSET in raw mode, wrap u32, and mischeck s_buffer_load (P0)Location:
crates/xcl/src/gpu/recomp/emit.rslines1704-1728, 3750-3769, 1495-1524Prior-Work Check: Searched all 4,430 XCL records for
OOB_SELECT,soffsetbounds,s_buffer_loadpartial-dword (Issue #307only discussednum_records * stride; 0 hits forOOB_SELECTor missingSOFFSET).Root Cause: Native RDNA2 (
gfx1036) & RDNA1 (gfx1011) measurements (Leonida/docs/buffer_bounds.md, 732 cases) prove hardware selects bounds checks by V# word 3OOB_SELECT(d3[29:28]): mode 0 checksindex >= N || offset + bytes > stride, mode 1 checksindex >= N, mode 2 checksN == 0, mode 3 (raw) checksoffset + soffset + bytes > N. XCL ignoresd3[29:28](usingstride == 0), omitssofffromt_offin raw mode (allowing OOB VRAM reads/writes wheneverSOFFSET != 0), skipsoffset + bytes <= stridein mode 0, wraps 32-bituintin single-window mode, and checkst_off < t_liminstead oft_off + 4 <= t_limins_buffer_load.Edge-Case / Verification Note: Alternative hypothesis: most shaders might pass
SOFFSET = 0. Falsification: AMD's LLVM backend routinely places constant/loop-invariant byte offsets inSOFFSET; synthetic rawbuffer_load_dwordwithN=18, voff=8, soff=8proves OOB leak.Synthetic Reproducer: Raw V# (
OOB_SELECT=3, NUM_RECORDS=18),buffer_load_dwordatvoff=8, soff=8(8+8+4=20 > 18): RDNA2 hardware returns0; XCL reads out-of-bounds VRAM because8+4 <= 18.Proposed Fix & Risk: - Fix: Decode
oob = (d3 >> 28) & 3u, perform bounds checks inuint64_t, include(uint64_t)soffin mode 3, checkt_off + bytes <= stridein mode 0, checkd2 != 0uin mode 2, and fixs_buffer_loadto(uint64_t)t_off + 4ull <= (uint64_t)t_lim.Regression Risk: Low; strictly aligns with measured RDNA1/RDNA2 silicon. (Estimated size:
M)3.
XCL-BT-003— Single global xcl-cpu-writes FIFO worker deadlocks/HOL-blocks across independent queues & tears 64-bit immediate writes (P0)Location:
crates/xcl/src/hle/d3d12x/cpu_writes.rslines56-104Prior-Work Check: Searched all 4,430 XCL records for
xcl-cpu-writes,cpu_writes,AtomicU32torn writes (PR #1005/#1034 cover VirtualQuery/watch only; 0 hits for cross-queue FIFO deadlock or torn 64-bit writes).Root Cause: (1) One global
xcl-cpu-writesFIFO thread pops jobs from all command queues in enqueue order and blocks onWaitForSingleObject(event, 10_000). If Queue A is waiting on a signal from Queue B's bottom-of-pipe write, Queue B's job is head-of-line blocked for 10 seconds until Queue A times out—and then Queue A's writes are prematurely committed before Queue A's GPU work completes. (2)write_now()(101-103) commitsWrite::Immediate(va, vec![lo, hi])as two non-atomicAtomicU32::storecalls, exposing torn 64-bit fence values to polling title threads.Edge-Case / Verification Note: Alternative hypothesis: titles might only use
Write64BitValueBottomOfPipeXon a single Direct queue. Falsification: modern GDK engines (including the retail title) use separate Direct, Async Compute, and Copy queues with cross-queue fence dependencies; synthetic 2-queue test deterministically triggers the 10 s deadlock.Synthetic Reproducer: Submit
Write64BitValueBottomOfPipeXon Queue A waiting on Fence B, then submitWrite64BitValueBottomOfPipeXon Queue B whose CPU poll unblocks Fence B ->xcl-cpu-writesstalls 10 s and fires Queue A's write prematurely.Proposed Fix & Risk: - Fix: Dispatch one worker per queue (or
WaitForMultipleObjectsacross per-queue queues) and addWrite::ImmediateU64(usize, u64)committed viaAtomicU64::store(..., Ordering::Release).Regression Risk: Low; preserves strict in-queue FIFO ordering while removing false cross-queue serialization. (Estimated size:
M)4.
XCL-BT-004— Uncompressed DirectStorage requests with source_size < destination_size panic (physical) or heap-over-read UB (virtual) (P0)Location:
crates/xcl/src/hle/dstorage.rslines881-940Prior-Work Check: Searched all 4,430 XCL records; PR #21 fixed only compressed intermediate buffers (
d.len() < ninsideif r.zlib()), leaving the uncompressed raw path (!r.zlib() && bc == 0) unguarded.Root Cause: When
!r.zlib() && bc == 0,payloadhas lengthr.source_size. Line935indexes&payload[..n](wheren = destination_size), panicking ifsource_size < destination_size; line939callsstd::ptr::copy_nonoverlapping(payload.as_ptr(), dst, n), causing heap-buffer-over-read UB.Edge-Case / Verification Note: Alternative hypothesis: GDK DirectStorage may reject
source_size < destination_sizeon uncompressed requests asE_INVALIDARG. Either way, panicking or executing UB heap-over-read is a confirmed defect; whether to zero-pad or returnE_INVALIDARGshould be matched to GDK behavior.Synthetic Reproducer: Unit test calling
execute_requestwith uncompressed memory source (source_size = 64, destination_size = 128) -> panics on physical-page dest / over-reads 64 B on virtual dest.Proposed Fix & Risk: - Fix: Validate
payload.len() >= n(returningE_INVALIDARGif invalid per GDK spec, or zero-paddingpayload.resize(n, 0)if padded destinations are permitted) before lines935/939.Regression Risk: Very low. (Estimated size:
XS)5.
XCL-BT-005— Unretained Raw pRootSignature Pointer in device_x::Base::desc Causes COM Use-After-Free in RSSetDepthBiasX and CreateDerivedPipelineStateX (P0)Location:
crates/xcl/src/hle/d3d12x/device_x.rslines355-386, 446-500, 521-565Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'note_base', 'depth_bias_pso', 'create_derived_pso_x', 'prootsignature', 'derivedpipelinestate': only PR #23 (initial implementation) and PR #144 (untranslated root sig binding) matched; zero issues or PRs report the unretained pRootSignature UAF in Base::desc.
Root Cause:
device_x::note_base(device_x.rs:355-386) copies the raw bytes ofD3D12_GRAPHICS_PIPELINE_STATE_DESC—including the rawpRootSignatureCOM pointer at offset0x00—intoBase::descwithout callingAddRefonpRootSignature(even though it carefully deep-copiesInputLayoutdescriptors and shader bytecode). In D3D12, titles are allowed to callroot_sig->Release()immediately after creating a PSO. Later, whendepth_bias_pso(device_x.rs:446-500) orcreate_derived_pso_x(device_x.rs:521-565) clonesBase::descand passes it toCreateGraphicsPipelineState, the driver dereferences a freed/danglingID3D12RootSignature*.Edge-Case / Verification Note: Verified
Basestruct definition andforget_baseindevice_x.rs:BaseownsVec<u8>copies of input layout/semantics/shaders but storespRootSignaturesolely as raw bytes insidedesc, with noOption<ID3D12RootSignature>field and noAddRef/Releaselifecycle management.Synthetic Reproducer: Create a root signature
rs, create a graphics PSOpsowithrs(e.g. without dynamic depth bias or on Intel/bundle fallback), callrs->Release(), then triggerRSSetDepthBiasXorCreateDerivedPipelineStateXonpso. The driver crashes with an access violation dereferencing the freedrsvtable insideCreateGraphicsPipelineState.Proposed Fix & Risk: - Fix: Extract
pRootSignatureinnote_base, retain anOption<ID3D12RootSignature>viafrom_raw_borrowed+.clone()onBase(releasing automatically whenBaseis dropped inforget_base), and keep it alive for the lifetime ofBase.Regression Risk: Low; retains one COM reference per cached base PSO until
forget_baseruns on PSO destruction. (Estimated size:S)6.
XCL-BT-006— dstorage.rs: factory_create_status_array initializes slots to E_PENDING instead of S_OK, deadlocking ring-buffer callers (P0)Location:
crates/xcl/src/hle/dstorage.rslines615-627Prior-Work Check: Verified 0 hits across ivall_xcl issues_and_prs.json, pulls.json, issue_comments.json, and review_comments.json for createstatusarray / statusarray E_PENDING.
Root Cause: In dstorage.rs:622,
factory_create_status_arrayinitializes every slot withAtomicI32::new(E_PENDING). Per Microsoft's DirectStorage specification (IDStorageStatusArray::IsComplete / GetHResult, and matching VIctory's dstorage.rs:165), newly created status array entries start in the completed state (S_OK,IsComplete() == true) untilEnqueueStatustransitions a slot toE_PENDING.Edge-Case / Verification Note: Titles that only call
IsComplete(i)after callingEnqueueStatus(array, i)do not observe the initial state, which is why existing unit tests passed. However, standard DirectStorage ring-buffer patterns wait onIsComplete(slot)before recyclingsloton its first pass.Synthetic Reproducer: Call IDStorageFactoryX::CreateStatusArray(4, ...) and immediately call status->IsComplete(0) and status->GetHResult(0); returns false and E_PENDING instead of true and S_OK.
Proposed Fix & Risk: - Fix: Initialize slots in
factory_create_status_arraywithAtomicI32::new(S_OK)at dstorage.rs:622.Regression Risk: Low; matches DirectStorage specification and only affects pre-enqueue slot state. (Estimated size:
S)7.
XCL-BT-007— kernelx.rs: map_pages allows consecutive page numbers spanning two distinct PHYS_BLOCKS allocations to commit past allocation A's bounds (P0)Location:
crates/xcl/src/hle/kernelx.rslines1222-1242Prior-Work Check: Verified 0 hits across ivall_xcl corpus for map_pages consecutive / cross-allocation PHYS_BLOCKS.
Root Cause: At kernelx.rs:1223-1225,
map_pageschecksconsecutiveon the numeric page IDs (pages[0] + i * FRAMES == pages[i]) and then setshome = page_home(pages[0]).filter(|_| page_home(pages[n - 1]).is_some()). BecauseAllocateTitlePhysicalPagesassigns monotonically increasing page IDs across separate allocations, two independent allocations A (at virtual addresshome_A) and B (at unrelated virtual addresshome_B) have consecutive page IDs.page_home(pages[n - 1]).is_some()passes even thoughpage_home(pages[n - 1]) != Some(home_A + (n - 1) * PHYS_PAGE), causingcommit_homes(home_A, n)to walk past block A's end.Edge-Case / Verification Note: Single-allocation mappings always have contiguous homes, so single-block tests pass. The bug triggers whenever a title concatenates page IDs from two consecutive physical allocations into one MapTitlePhysicalPages call.
Synthetic Reproducer: Call AllocateTitlePhysicalPages twice (1 page each -> page IDs p0 and p0+16 with distinct non-adjacent home VAs), then call MapTitlePhysicalPages(NULL, 2, 0, PAGE_READWRITE, [p0, p0+16]); commits 128 KiB starting at home(p0) instead of returning ERROR_NOT_SUPPORTED.
Proposed Fix & Risk: - Fix: Verify that
pages[0]andpages[n - 1]belong to the SAMEPHYS_BLOCKSentry (or thatpage_home(pages[n - 1]) == Some(home_0 + (n - 1) * PHYS_PAGE)and all intermediate pages belong to the same block) before taking the contiguous home fast path.Regression Risk: Low; strictly tightens safety validation on the home fast path. (Estimated size:
S)8.
XCL-BT-008— pso_async::resolve / resolve_wait Returns Unretained Raw ID3D12PipelineState* Pointer Racing With released() (COM Use-After-Free) (P0)Location:
crates/xcl/src/hle/d3d12x/pso_async.rs, crates/xcl/src/hle/d3d12x/real.rslinespso_async.rs:354-367, 376-394, 448-458; real.rs:1598-1606Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'pso_async', 'resolve_wait', 'resolve_for_bind', 'pso_release': matches cover async compute registration (#102), wait logging (#899), preload worker priority inversion (#1007), and duplicate build experiment (#754); zero issues or PRs cover the raw-pointer UAF race between resolve/resolve_wait and released().
Root Cause:
pso_async::resolve(pso_async.rs:354-367) andresolve_wait(pso_async.rs:376-394) loadp.real.load(Ordering::Acquire)and return the rawusizeID3D12PipelineState*pointer without incrementing its COM refcount. Concurrently, another thread releasing the stand-in PSO invokespso_release(real.rs:1598-1606) ->pso_async::released(standin)(pso_async.rs:448-458), which atomically swapsp.realto0and callsrelease(real), dropping the sole COM reference to the compiled PSO while the first thread is about to pass that raw pointer toSetPipelineState,Reset, orCreateCommandList.Edge-Case / Verification Note: Confirmed that
p.realholds the only COM reference to the compiled PSO (the title only owns a reference tostandin). Neitherresolvenorresolve_waitholds a lock or callsAddRefbefore returning the rawusizeto callers inlist_x.rs,bind.rs, andreal.rs, creating a classic cross-thread COM UAF window whenever a streaming/GC thread releases a PSO concurrently with command-list recording.Synthetic Reproducer: On thread A, bind a stand-in PSO via
SetPipelineState(resolve_for_bind/resolve_wait); on thread B, concurrently callstandin->Release()once the background compile finishes. Thread A receives the rawrealpointer just before thread B'sreleased()drops its refcount to 0, causingSetPipelineStateto dereference a freedID3D12PipelineState.Proposed Fix & Risk: - Fix: Have
resolve/resolve_waitreturn an ownedID3D12PipelineState(callingAddRefwhile holding the map/entry guard beforereleased()can runrelease(real)), or routereleased()throughlate_release/ a mutex-protectedOption<ID3D12PipelineState>cloned before unlocking.Regression Risk: Low; adds one atomic
AddRef/Releasepair per async-PSO resolution on the binding path. (Estimated size:M)9.
XCL-BT-009— sparse::flush_parked Returns Unmapped VRAM Pool Tiles to self.free Without Waiting for In-Flight Title Queues (GPU UAF / Corruption) (P0)Location:
crates/xcl/src/hle/d3d12x/sparse.rslines587-601, 1355-1413, 1454-1456Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'flush_parked', 'decommit_range', 'take_tile', 'parked': PR #532 introduced parked tile batching to reduce UpdateTileMappings overhead, PR #923/#930 addressed retired 64 MiB pool reuse after unmap fence, and Issue #262 covers upload-vs-title simultaneous access on the same reserved buffer; zero issues or PRs cover flush_parked immediately recycling unmapped pool tiles to self.free before in-flight title queues finish.
Root Cause: In
sparse::flush_parked(sparse.rs:1355-1413), called frombefore_execute(sparse.rs:1454-1456), decommitted tiles are unmapped viaUpdateTileMappingson XCL's privates.queueand then immediately pushed back intoself.free(for tile in freed { self.free.push(tile); }).flush_parkednever waits for any title command queues (DIRECT/COMPUTE/COPY) that may still have GPU work in flight reading or writing those tiles, nor does it even wait fors.queue's own unmap fence beforetake_tile(sparse.rs:587-601) pops the tile, remaps it to a different virtual address, and zeroes/overwrites it viaupload_zeros/upload_dirty.Edge-Case / Verification Note: Verified
Pool::retire_emptyvsflush_parked: PR #930 added a fence check for retired 64 MiB pools, but individual tiles freed bydecommit_range->flush_parkedbypass any fence wait and are returned straight toself.freesynchronously insideflush_parked, allowing immediate reuse on the very next commit while prior title submits are still executing on the GPU.Synthetic Reproducer: Submit a GPU compute/graphics command list reading from sparse address
A, immediately decommitA(VirtualFree/FreeTitlePhysicalPages) and commit new sparse addressB(which popsA's pool tile fromself.freeand uploads zeros/new data ons.queue). The in-flight title draw/dispatch reads zeroed orB's data from the recycled physical tile.Proposed Fix & Risk: - Fix: Place tiles unmapped by
flush_parkedinto a per-fence retired tile quarantine (recording the current fence values ofs.queueand active title queues, or reusing the existinglate_releasequeue-fence drain), and only move them intoself.freeonce all in-flight queue fences have completed.Regression Risk: Medium; slightly increases transient VRAM pool watermark by one frame's worth of decommitted tiles, which is bounded and avoids silent GPU data corruption. (Estimated size:
M)10.
XCL-BT-010— FMT_INFO[min(fmt, 77u)] clamps out-of-range 7-bit format codes 78..127 to format 77 (32_32_32_32_FLOAT) instead of 0 (INVALID) (P1)Location:
crates/xcl/src/gpu/recomp/emit.rslines1780, 1816Prior-Work Check: Searched all 4,430 XCL records for
FMT_INFOandmin(fmt, 77(0 hits).Root Cause: Measured on RDNA2 silicon (
ProjectLeonidaL/leonidadocs/buffer_formats.md:24), 7-bit unified buffer format codes outside1..=77(specifically0and78..=127) areINVALID: loads decode to0and stores are no-ops.emit.rs:1780andemit.rs:1816indexFMT_INFO[min(fmt, 77u)], silently aliasing every invalid format code78..=127to format77(32_32_32_32_FLOAT), reading/writing 16 bytes of garbage memory instead of returning0/ storing nothing.Edge-Case / Verification Note: Alternative hypothesis: valid Xbox titles never bind descriptors with format codes
>= 78. Falsification: null/uninitialized or dynamically-patched buffer descriptors (andtbufferimmediate format encodings) can carry format codes>= 78, causing out-of-bounds 16-byte writes instead of hardware no-ops.Synthetic Reproducer: Bind a buffer V# with
FORMAT = 80and executebuffer_store_format_xyzworbuffer_load_format_xyzw. Hardware performs a no-op / returns0; XCL indexesFMT_INFO[77]and reads/writes 16 bytes as32_32_32_32_FLOAT.Proposed Fix & Risk: - Fix: Replace
min(fmt, 77u)with(fmt <= 77u ? fmt : 0u)atemit.rs:1780andemit.rs:1816so out-of-range codes map toFMT_INFO[0](INVALID).Regression Risk: Very low; two one-line ternary guards. (Estimated size:
XS)11.
XCL-BT-011— FreeTitlePhysicalPages double-free UAF of live sibling pages & monotonic NEXT_PAGE_INDEX 21-bit exhaustion (P1)Location:
crates/xcl/src/hle/kernelx.rslines1154-1199Prior-Work Check: Searched all 4,430 XCL records for
FreeTitlePhysicalPagesdouble-free andNEXT_PAGE_INDEXrecycling (PR #40/#348 cover multi-window bounds and test lock ordering only; 0 hits for double-free UAF or index exhaustion).Root Cause:
PHYS_BLOCKSstores(count, live_count, home)per block.FreeTitlePhysicalPagesdecrementse.1without per-page liveness tracking, so freeing the same page twice dropse.1to0and releaseshomewhile sibling pages in the block are still live (UAF). Separately,NEXT_PAGE_INDEXmonotonically increments and is never recycled.Edge-Case / Verification Note: Alternative hypothesis: well-behaved titles never double-free physical pages. Falsification: duplicate free is a single-line reproducer in unit tests, and monotonic
NEXT_PAGE_INDEXinevitably hits 21-bit exhaustion under long streaming churn.Synthetic Reproducer: Allocate 2 pages
[p0, p1]in one block; callFreeTitlePhysicalPages(1, &[p0])twice ->e.1hits0andhomeis freed whilep1is still live.Proposed Fix & Risk: - Fix: Store a per-block freed bitset (
Vec<u64>) so duplicate frees are ignored, and recycle freed page indices via a free-list.Regression Risk: Low. (Estimated size:
S)12.
XCL-BT-012— Pixel shader export_graphics ignores VM (Valid Mask) bit and per-MRT color export masks (P1)Location:
crates/xcl/src/gpu/recomp/emit.rslines1919-1985Prior-Work Check: Searched all 4,430 XCL records for
export_graphics,xcl_live, andvalid mask(only #706 mentionsvmin disassembler text formatting; 0 hits forexport_graphicssemantics).Root Cause: Measured across 18 pixel shader programs on RDNA2
gfx1036(ProjectLeonidaL/leonidadocs/design.md:267,ps_oracle.py), pixel survival is determined by theEXECmask of the lastexpwithVM=1(overwriting earlierVMmasks rather than OR-accumulating), and color target survival is masked per-MRT.emit.rs:1919-1985ignores theVMbit entirely and OR-accumulatesif (act) xcl_live = true;onDONE, so a laterexp null done vmunder a narrowerEXECfails to kill lanes that were active during an earlier export.Edge-Case / Verification Note: Alternative hypothesis: pixel shaders might only emit a single
DONEexport at exit. Falsification: multi-MRT and early-discard shaders emitexp mrt0before branching toexp null done vm, where OR-accumulatingxcl_liveonDONEleaks killed pixels into the framebuffer.Synthetic Reproducer: Pixel shader executing
exp mrt0 ...withEXEC = 0xF, then narrowingEXEC = 0x3and executingexp null ... done vm. Hardware kills lanes 2 and 3; XCL keeps them alive or mis-tracks survival when multiple exports carryVM/DONE.Proposed Fix & Risk: - Fix: Decode the
VMbit from theEXPinstruction inexport_graphics, assignxcl_live = act;(overwrite, not OR-accumulate) on everyVM=1export, and guard finaldiscardwithif (!xcl_live) discard;while tracking per-MRT export masks.Regression Risk: Low-medium; localized to pixel-shader
export_graphics. (Estimated size:M)13.
XCL-BT-013— TOCTOU Race Between alloc_pool::reset_list and Concurrent title_reset Allows Resetting an Actively Recording Command Allocator (P1)Location:
crates/xcl/src/hle/d3d12x/alloc_pool.rslines89-102, 195-216Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'alloc_pool', 'reset_list', 'title_reset', 'move_list': PR #1012 fixed released list cleanup, PR #1023 fixed moving recording only after successful Reset, PR #1051/#994 fixed failed replacement/aside handling, and PR #1071 fixed split/created list tracking; zero issues or PRs cover the lock-drop TOCTOU race between reset_list and title_reset.
Root Cause: In
alloc_pool::reset_list(alloc_pool.rs:89-102), the function querieslet backing = current(alloc);(releasing thePOOLSmutex), invokes the nativelist->Reset(backing)callback without holding thePOOLSmutex or pinningbacking, and only acquiresPOOLSafterward to callmove_list(list, backing). If another thread concurrently callstitle_reset(alloc)(alloc_pool.rs:195-216) during that window,title_resetseesbacking'susersset as empty (users.is_empty() == true) and immediately callsID3D12CommandAllocator::Reset()onbackingwhilelistis actively recording intobacking(violating D3D12's requirement that no open command list use a resetting allocator, causingE_FAIL/ driver crash / device removal).Edge-Case / Verification Note: Verified
current(alloc)drops thePOOLSguard before returningbacking, andtitle_resetcheckspool.users.get(&backing).is_none_or(|u| u.is_empty())before resettingbackingin place. While PR #1023 intentionally movedmove_listafterreset(backing)so failedResetdoesn't corrupt state, leavingbackingunpinned across the unlocked native call opens a direct race with concurrenttitle_reset.Synthetic Reproducer: On thread A, call
list->Reset(alloc, pso)whilealloccurrently has 0 open lists; on thread B, concurrently callalloc->Reset()right after thread A readsbacking = current(alloc)and enters nativelist->Reset(backing). Thread B resetsbackingin place while thread A's list is now open onbacking.Proposed Fix & Risk: - Fix: Increment an in-flight pin/reservation count on
backing(or insert a pending reservation entry inPOOLS) while holding thePOOLSlock before callingreset(backing), havetitle_resettreat pinned backings as busy (swapping in a spare instead of resetting in place), and commitmove_listor roll back the pin afterreset(backing)returns.Regression Risk: Low; purely internal synchronization inside
alloc_pool.rswith negligible lock contention. (Estimated size:S)14.
XCL-BT-014— Thick 3D mip-tail predicate in tiling.rs omits depth_of(i) <= td (P1)Location:
crates/xcl/src/gpu/tiling.rslines299-317Prior-Work Check: Searched all 4,430 XCL records for
first_tail,GetMipTailDim,thicktail depth (PR #1028 covers linear tile-mapping region on 3D mips; 0 hits fortiling.rs:315missing depth check).Root Cause:
GetMipTailDimhalvesh,w, ordbyblk % 3, yettiling.rs:299-316discardstdand tests onlyw <= tw && h <= th && mips - i <= max_tail, forcing deep narrow thick 3D mips (e.g.16x16x64) into the single-block mip tail.Edge-Case / Verification Note: Alternative hypothesis: retail volume textures tested so far had
w > tworh > thwheneverd > td. Falsification: unit testChain::new_3d(Layout::new_3d(5, 2, cfg), 16, 16, 64, 1, 4)places mip 0 into the mip tail.Synthetic Reproducer: Unit test in
gpu/tiling.rs:16x16x64thick 3D texture with 4 mips ->levels[0].tail.is_some()despite 64 depth slices exceeding block depth.Proposed Fix & Risk: - Fix: Compute
td = if !thick { usize::MAX } else if blk % 3 == 2 { bd / 2 } else { bd }and add&& (!thick || depth_of(i) <= td)at line315.Regression Risk: Very low. (Estimated size:
XS)15.
XCL-BT-015— XMA2 StreamConfig::from_xma2_wfx Miscomputes Stereo/Mono Channel Layout for Multi-Stream XMA2WAVEFORMATEX (e.g., 5.1 4-Stream, 4.0 3-Stream) (P1)Location:
crates/xcl/src/hle/xma2/mod.rslines69-94Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'from_xma2_wfx', 'xma2waveformatex', 'num_streams': PR #20 introduced the XMA2 decoder and open PR #861 adds tests only without fixing the layout formula in from_xma2_wfx.
Root Cause: In
StreamConfig::from_xma2_wfx(xma2/mod.rs:69-94), whenXMA2WAVEFORMATEXspecifieschannelsandnum_streams(without per-stream descriptors), the loop assigns2channels to every stream where(i + 1) * 2 <= channelsand1otherwise. For standard Xbox 5.1 (channels = 6, num_streams = 4, layout[2, 2, 1, 1]= FL/FR, BL/BR, C, LFE) or 4.0 (channels = 4, num_streams = 3, layout[2, 1, 1]), this loop assigns2to streams0, 1, 2and1to stream3, producing[2, 2, 2, 1](sum = 7 != 6) or[2, 2, 1](sum = 5 != 4), which then failsDecoder::new's channel-sum check (channel sum 7 != 6) and completely breaks playback of valid multi-stream surround XMA2 assets.Edge-Case / Verification Note: Verified algebraically: given
Ctotal channels acrossSstreams where each stream has 1 or 2 channels (S <= C <= 2*S), the unique count of stereo (2-channel) streams isstereo = C - Sand mono (1-channel) streams is2*S - C. ForC=6, S=4,stereo = 2->[2, 2, 1, 1](sum 6); the existing code computesi=0,1,2as2because(2+1)*2 <= 6, producing[2, 2, 2, 1](sum 7) and unconditionally failing.Synthetic Reproducer: Call
StreamConfig::from_xma2_wfxwith a valid 5.1XMA2WAVEFORMATEXheader (nChannels = 6,NumStreams = 4,nSamplesPerSec = 48000) and pass the resulting config toDecoder::new(cfg).Decoder::newreturnsErr("channel sum 7 != 6").Proposed Fix & Risk: - Fix: Validate
channels >= num_streams && channels <= num_streams * 2, computelet stereo = (channels - num_streams) as usize;, and assignif i < stereo { 2 } else { 1 }for each streami in 0..num_streams.Regression Risk: Very low; preserves existing
[2, 2, 2](6ch/3-stream) and[2, 1](3ch/2-stream) behavior while fixing all mixed stereo/mono multi-stream surround layouts. (Estimated size:XS)16.
XCL-BT-016— XMA2 advance_stream Decrements skip_packets == 255 (0xFF EOF Sentinel), Causing Finished Streams to Steal Packets After 255 Packets (P1)Location:
crates/xcl/src/hle/xma2/mod.rslines1764-1780Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'advance_stream', 'skip_packets': only PR #20 (initial XMA2 decoder commit) matched; zero issues or PRs cover the skip_packets == 255 EOF sentinel bug.
Root Cause: In the XMA2 packet header, the 8-bit
PacketSkipCountvalue255(0xFF) is the stream-finished sentinel indicating that no further packets belong to that stream. InDecoder::advance_stream(xma2/mod.rs:1764-1780), every stream's counter is unconditionally decremented vias.skip_packets = s.skip_packets.saturating_sub(1);. In multi-stream surround or multi-track XMA2 audio where one stream ends earlier than another by more than 255 packets, the finished stream'sskip_packetscounts down255 -> 254 -> ... -> 0, after whichadvance_streamselects the finished stream asbest(min_skip == 0) and feeds another active stream's packets into it, corrupting both streams.Edge-Case / Verification Note: Verified
xma2/mod.rs:1525-1535parsesskip_packetsdirectly as an 8-bitu8(0..=255) from the 32-bit XMA2 packet header, andadvance_stream(1777-1779) has noif s.skip_packets != 255guard. In FFmpegwmaprodec.c,skip_packets == 0xffis explicitly treated as a pinned terminal state (never decremented).Synthetic Reproducer: Decode a 2-stream (e.g. 4-channel) XMA2 asset where stream 0 finishes (
PacketSkipCount = 255) while stream 1 has 260 more packets. After 255 packets of stream 1, stream 0'sskip_packetsreaches 0 and stream 0 steals stream 1's packet 256, causing bitstream decode errors or channel corruption.Proposed Fix & Risk: - Fix: Guard the decrement in
advance_stream:if s.skip_packets != 255 { s.skip_packets = s.skip_packets.saturating_sub(1); }(and mark or skip streams withskip_packets == 255unless all streams are 255).Regression Risk: Very low; 1-line guard matching the XMA2 packet header specification and FFmpeg. (Estimated size:
XS)17.
XCL-BT-017— XMA2 decode_packet_step Unconditionally Decodes Incomplete Reservoir on 3+-Packet Spanning Frames, Triggering packet_loss and Wiping Saved Bits (P1)Location:
crates/xcl/src/hle/xma2/mod.rslines1566-1582Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'decode_packet_step', 'num_bits_prev_frame', 'packet_loss', 'num_saved_bits': only PR #20 (initial decoder commit) matched; zero issues or PRs report the 3+-packet spanning frame bug.
Root Cause: In
StreamDecoder::decode_packet_step(xma2/mod.rs:1566-1582), when a frame spans across packets and the current packet'snum_bits_prev_frame >= remaining_packet_bits(including the XMA2 continuation sentinel0x7FFFmeaning no new frame starts in this packet), the code setsself.packet_done = true, clamps the bit count toremaining_packet_bits, appends those bits to the saved-bit reservoir viasave_bits, and then unconditionally callsself.decode_frame(out_frame)on line 1575. When a large frame spans 3 or more packets (num_bits_prev_frame > remaining_packet_bits), the reservoir does not yet contain the end of the frame:decode_framefails mid-frame, setsself.packet_loss = true, and line 1580 wipesself.num_saved_bits = 0, permanently corrupting the spanning frame and dropping audio.Edge-Case / Verification Note: Compared directly against FFmpeg's
xma_decode_packet/decode_packetinlibavcodec/wmaprodec.c: whennum_bits_prev_frame > remaining_packet_bits(e.g.,0x7FFFcontinuation packet), FFmpeg appends allremaining_packet_bitsto the saved reservoir and returns immediately (got_frame = 0) WITHOUT callingdecode_frame, waiting for the subsequent packet that completes the frame.xma2/mod.rs:1566-1582conflates>=(exact completion vs strict continuation) and always callsdecode_frame.Synthetic Reproducer: Feed a valid XMA2 stream containing a high-bitrate frame spanning 3 consecutive 2048-byte packets (packet 1 starts the frame, packet 2 has
bit_offset == 0x7FFF/num_bits_prev_frame > 16352, packet 3 finishes the frame). On packet 2,decode_packet_stepcallsdecode_frameon the incomplete reservoir, fails withpacket_loss = true, and zeroesnum_saved_bits.Proposed Fix & Risk: - Fix: Distinguish
num_bits_prev_frame > remaining_packet_bits: appendremaining_packet_bitsviasave_bits, setself.packet_done = true, and returnOk((pgb.bits_count() >> 3, false))without invokingdecode_frameor clearingnum_saved_bits.Regression Risk: Low; matches FFmpeg
wmaprodec.cbehavior for multi-packet XMA2 continuation packets. (Estimated size:S)18.
XCL-BT-018— acphal.rs: XApu ignores XAPU_CONNECT_OPTION_DEINTERLEAVED_OUTPUT (options & 4), corrupting stereo PCM layout (P1)Location:
crates/xcl/src/hle/acphal.rslines711-717, 775, 927-953Prior-Work Check: Verified 0 hits across ivall_xcl corpus for deinterleaved.
Root Cause: XApu struct (acphal.rs:711-717) never stores
i.optionsfrom XApuConnectInput, and XApuEnqueueCommand (lines 933-943) unconditionally copies interleavedf32samples fromdecode_intointop.outputregardless of whetheroptions & 4(DEINTERLEAVED_OUTPUT) was requested.Edge-Case / Verification Note: Titles using interleaved output (options & 4 == 0) or mono streams (channels == 1) are unaffected, but stereo deinterleaved titles (explicitly supported in VIctory's apu.rs:46,345-348) receive garbled audio.
Synthetic Reproducer: Connect with XApuConnectInput { options: 4, ... }, activate a 2-channel Opus stream, enqueue XAPU_PROCESS, and inspect p.output; samples are interleaved [L0, R0, L1, R1] instead of [L0..L(n-1), R0..R(n-1)].
Proposed Fix & Risk: - Fix: Store
options: u32instruct XApuat XApuConnect, and whenx.options & 4 != 0 && channels == 2, deinterleaveoutinto[L0..Ln, R0..Rn]before copying top.output.Regression Risk: Low; only affects stereo streams with option bit 2 set. (Estimated size:
S)19.
XCL-BT-019— bind::execute_indirect Uses Unretained Raw s.rs_gfx With SetGraphicsRootSignature Even on COMPUTE Lists (COM UAF + Invalid Compute Queue Call) (P1)Location:
crates/xcl/src/hle/d3d12x/bind.rslines175-182, 235-261Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'rs_gfx', 'execute_indirect', 'setgraphicsrootsignature': PR #144 added rs_gfx binding, PR #267/#667/#1124 cover slow PSO waits, ABI caching, and two-pass mesh skip; zero issues or PRs cover unretained rs_gfx UAF or invalid SetGraphicsRootSignature on COMPUTE lists in execute_indirect.
Root Cause: Two compounded bugs in
bind.rs: (1)set_graphics_root_signature(bind.rs:175-182) stores the title's root signature as a rawusize(s.rs_gfx = rs as usize) withoutAddRefing it; if the title releases the root signature while the command list is still recording (valid in D3D12 while referenced by the command list, or acrossinherit_for_split),execute_indirect(bind.rs:256-259) borrows and callslist.SetGraphicsRootSignature(r)on a dangling pointer. (2) Whenexecute_indirectruns with an untranslated PC compute pipeline on aCOMPUTEcommand list,if !gfx && !compute(bind.rs:241-260) unconditionally attemptslist.SetGraphicsRootSignature(r)ifs.rs_gfx != 0(invalid onD3D12_COMMAND_LIST_TYPE_COMPUTE), and never restores a compute root signature (rs_computeis not even tracked).Edge-Case / Verification Note: Verified
Stateinbind.rs:22-37:rs_gfx: usizeis a raw integer with noOption<ID3D12RootSignature>wrapper, andexecute_indirectlines 256-259 do not checklist.GetType() == D3D12_COMMAND_LIST_TYPE_DIRECTbefore callingSetGraphicsRootSignature.Synthetic Reproducer: Bind a graphics root signature
rs, releaserson CPU, then invokeExecuteIndirectwith an untranslated PC PSO (triggering COM UAF onrs); or execute an untranslated computeExecuteIndirectafter a translated dispatch without restoring the compute root signature.Proposed Fix & Risk: - Fix: Store
rs_gfx: Option<ID3D12RootSignature>(retained viafrom_raw_borrowed+.clone(), cleared onreset/clear_state/forget) and guardlist.SetGraphicsRootSignatureinexecute_indirectto only run onDIRECT/BUNDLEcommand lists (tracking and restoringrs_compute: Option<ID3D12RootSignature>for compute lists).Regression Risk: Low; retains at most two COM root-signature references per active command list until reset/release. (Estimated size:
S)20.
XCL-BT-020— buffer_load_format_d16_* / tbuffer_load_format_d16_* zeroes odd-channel high 16 bits, truncates UINT/SINT, and double-rounds UNORM/SNORM (P1)Location:
crates/xcl/src/gpu/recomp/emit.rslines1787-1805Prior-Work Check: Searched all 4,430 XCL records for
mubuf_d16andbuffer_load_format_d16(only #159 opcode census; 0 hits for odd-channel high half, integer saturation, or UNORM/SNORM double-rounding).Root Cause: Measured on RDNA2
gfx1031(ProjectLeonidaL/leonidadocs/shader_validation.md:1642,1658-1665,d16_format_probe.py),*_load_format_d16_*has three contracts violated byemit.rs:1787-1805: (1) odd-channel loads (d16_x,d16_xyz) preservevdst[31:16], whereas XCL overwrites the full 32-bit VGPR with zeroed high 16 bits; (2) 32-bitUINT/SINTformats saturate to[0, 65535]/[-32768, 32767], whereas XCL truncates via& 0xFFFFu; (3)16_UNORM/16_SNORMsingle-round directly to f16 RNE (0xFFAF -> 0x3BFD,0xFFEF -> 0x3BFF,0x7FF7 -> 0x3BFF,0x8009 -> 0xBBFF), whereas XCL widens to f32 and callsf32tof16, double-rounding boundary values.Edge-Case / Verification Note: Alternative hypothesis: odd-channel
d16destinations might not hold live high-half state. Falsification: RDNA2 16-bit register allocation packs two independent half-precision values into one VGPR, and integer truncation turns65536into0.Synthetic Reproducer: Pre-load
v0 = 0x5A5A_0000, runbuffer_load_format_d16_x v0, v1, s[0:3], 0 idxenon a32_UINTvalue70000. Hardware producesv0 = 0x5A5A_FFFF; XCL produces0x0000_1170.Proposed Fix & Risk: - Fix: Preserve
(vdst & 0xFFFF0000u)on odd trailing channels, clampUINT/SINTto 16-bit signed/unsigned ranges before masking, and perform direct single-rounded f16 RNE conversion forUNORM/SNORM.Regression Risk: Low; localized to
mubuf_d16. (Estimated size:S)21.
XCL-BT-021— bvh::world_to_object Divides by Unguarded det, Writing NaN/Inf Inverse Transforms for Zero-Scale or Degenerate TLAS Instances (P1)Location:
crates/xcl/src/gpu/bvh.rslines217-235Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'world_to_object', 'bvh.rs', 'singular', 'det == 0': PR #26 (initial BVH) and PR #107 (triangle_hit det underflow/overflow) matched; zero issues or PRs cover singular/zero-scale instance matrices in world_to_object.
Root Cause: In
bvh::world_to_object(bvh.rs:217-235), the 3x3 cofactor matrix of a TLAS instance'sobject -> worldtransform is unconditionally divided bydet(row.map(|x| x / det)). Titles routinely disable or cull dynamic raytracing instances without rebuilding instance buffers by writing an all-zero or zero-scale 3x4 transform matrix (det == 0.0). Dividing by0.0populates all 12f32words of the instance node'sworld -> objecttransform (offset+64..+112) withNaNor±inf. When a ray reaches the instance node, transforming the ray into object space producesNaNray origin/direction, propagatingNaNthrough BLAS traversal or causing undefined hit behavior.Edge-Case / Verification Note: Verified
build_top(bvh.rs:98-121) unconditionally callsworld_to_object(m)for everyInstancewithout checkingdet == 0.0or skipping singular transforms. Whiletransform_aabbcollapses a zero-scale instance to a point AABB(t, t), rays grazing or originating attstill pass the box test and enter theNaNinstance transform.Synthetic Reproducer: Call
bvh::build_topwith anInstancewhosetransformis all zeros (or has a zero scale row/column). Inspect bytes+64..+112of the emitted 128-byte instance node: all 12f32values areNaN.Proposed Fix & Risk: - Fix: Guard
if det.abs() <= 1e-30(or!det.is_finite() || det == 0.0) inworld_to_objectand return a safe zero/identity fallback (and inbuild_top, emit a NaN-disabled AABB for degenerate zero-area/singular instances withdet == 0.0so rays cleanly skip them).Regression Risk: Very low; preserves exact inverse matrices for all invertible transforms while preventing
NaNpropagation on disabled/degenerate instances. (Estimated size:XS)22.
XCL-BT-022— console_list::cl_release Immediately Frees UMA Argument/IO Blocks While Submitted GPU Work Is Still In Flight (GPU UAF Under XCL_CONSOLE_LISTS) (P1)Location:
crates/xcl/src/hle/d3d12x/console_list.rslines377-393Prior-Work Check: Verified 0% overlap across 4,430 ivall_xcl records. Searched 'console_list', 'cl_release', 'free_uma': PR #45 (initial sparse VRAM), PR #510 (reuse record chunk across Reset), and PR #806 (oversized chunks) do not mention cl_release freeing st.uma immediately instead of deferring to PENDING[st.alloc].
Root Cause: In
console_list.rs,cl_resetproperly defers freeing the previous recording's UMA argument-table/IO blocks (st.uma) by moving them intoPENDING[old_alloc]viahold_until_reset, so they stay alive until the title resets the command allocator after GPU completion. However,cl_release(console_list.rs:377-393) callsfree_uma(&st.uma)immediately when the command list's refcount drops to 0. In D3D12, titles are allowed to release a closed command list right after callingExecuteCommandListswhile the GPU is still executing it (only the command allocator must stay alive). Callingfree_uma(&st.uma)immediately frees and recycles the UMA argument tables and IO buffers out from under in-flight GPU shaders.Edge-Case / Verification Note: Compared
bind::forget(bind.rs:125-129, which correctly callsconsole_list::hold_until_reset(s.allocator, s.uma)) againstconsole_list::cl_release(console_list.rs:377-393, which directly callsfree_uma(&st.uma)).bind::forgetalready demonstrates the right allocator-scoped deferral;cl_releasemissed it.Synthetic Reproducer: Under
XCL_CONSOLE_LISTS=1, record a command list with translated dispatches/draws (allocating UMA blocks inst.uma), close it, submit it viaExecuteCommandLists, and immediately calllist->Release()before the GPU finishes executing the list.cl_releasefreesst.umaimmediately while the GPU still reads those argument tables.Proposed Fix & Risk: - Fix: In
console_list::cl_release, replacefree_uma(&st.uma)withhold_until_reset(st.alloc, st.uma)(matchingcl_resetandbind::forget).Regression Risk: Very low; 1-line fix matching
cl_resetandbind::forget. (Estimated size:XS)github-bot referenced this issue2026-11-26 05:09:52 +00:00
@oni-swr on GitHub · 2026-11-24 18:10 UTC · original · edited 2026-11-24 18:17 UTC
Claimed and opened #1619 for XCL-BT-005 (\device_x::Base\ unretained \pRootSignature\ COM UAF in \crates/xcl/src/hle/d3d12x/device_x.rs).
9e3831e, passes at \8cc8b6c).AI use: T3 Code / Antigravity (Gemini 4 Neon) verified the code, wrote the fix and test, ran validation, and updated this comment.
@ddaikodaiko on GitHub · 2026-11-24 18:57 UTC · original · edited 2026-11-24 19:37 UTC
Three items from this audit reproduced on current
mainand fixed locally. After the repo movedto
xcl-dev/xcland PR #1426 merged the direct DXIL translator, everything was rebased ontomainc160d86; the full HLSL suite is 860 passed, 0 failed, 42 ignored, 2 SKIPPED(
no wave64) on an RTX 3060 Ti 8 GB / driver 32.0.16.1088, Ryzen 5 1600, Windows 10 22H219045.7846, Agility SDK 1.620.2, DXC 1.8.2502.11, rustc 1.100.0, release. BT-002 and BT-010
are ported to the opt-in direct translator too: with
XCL_DIRECT_DXIL=1the same GPU testsfail on
mainand pass with the port (gpu::dxil80 passed). The patches are local, notPRs — XCL does not accept PRs written with DeepSeek models — and are ready for a human /
frontier-model contributor to submit under the project rules.
XCL-BT-002 (P0) — MUBUF/MTBUF bounds and
OOB_SELECTMeasured rule used (
Leonida/docs/buffer_bounds.md, 732 native cases on gfx1036, confirmed ongfx1011; 729/732 match Mesa's GFX11 column):
OOB_SELECTindex < Nandoffset + bytes <= STRIDEindex < NN != 0offset + soffset + bytes <= N;index * stridenot checkedemit.rsnow readsOOB_SELECTfrom the V# (word 3[28:29]), selects the four rulesbranch-free, includes
SOFFSETin the raw check and uses 64-bit offsets/limits/addresses; theold
stride == 0heuristic is gone.s_buffer_loadchecksoffset + 4 <= limitper dword(grouped loads check each of the four) with a 64-bit limit. Five synthetic tests that model raw
buffers now set
OOB_SELECT = 3, as a real title does.Test
gpu_mubuf_oob_select_raw_soffset_and_structured_stride:0xA0000004(8+4 <= 18, soffset ignored); fixreturns 0.
Test
gpu_s_buffer_load_limit_includes_the_dword: N 3, offset 0 — main reads0xAAAA0001(0 < 3); fix returns 0 (0+4 > 3). N 4 still reads0xBBBB0002.Direct DXIL (PR #1426,
XCL_DIRECT_DXIL=1): the same rules are ported togpu/dxil/lower_mem.rs; with the opt-in direct translator the two tests fail onmainand passwith the port (
gpu::dxil80 passed).XCL-BT-010 — invalid buffer format codes
FMT_INFO[min(fmt, 77u)]aliased format codes 78..127 to32_32_32_32_FLOAT. They are INVALIDon RDNA2: loads return 0 and stores are no-ops. The fix maps them to
FMT_INFO[0].Test
gpu_invalid_buffer_format_reads_zero_and_stores_nothing: onmaina V# withFORMAT = 80reads
0x3F800000..; with the fix the load returns 0 and the store leaves the target untouched.The direct translator's
fmt_infohad the samemin(fmt, 77); it is ported too, and withXCL_DIRECT_DXIL=1the test fails onmainand passes with the port.XCL-BT-038 —
v_pack_b32_f16abs/negThe packed halves ignored the VOP3 f16 sign modifiers.
absnow clears bit 15 andnegflips iton the selected half (bit-exact, NaN included).
Test
gpu_v_pack_b32_f16_honors_abs_neg(NEG on the low half, ABS on the high half): main gives0xC0003C00(+1.0, -2.0); the fix gives0x4000BC00(-1.0, |-2.0|).Not tested: AMD / native wave64, a retail title /
xcl-smoke, gfx1013 itself (the boundstable is gfx1036 + gfx1011), and the direct DXIL path for BT-038 (not ported yet).
AI use: OpenCode with DeepSeek V4.1 Flash wrote the fixes and tests, ran them on the machine
above and drafted this comment. The measured bounds table is from Leonida's GPL-3.0
documentation (facts only; no Leonida code is used). The patches are available locally for a
human / frontier-model contributor to submit.
@b3IKK on GitHub · 2026-11-24 19:37 UTC · original
Measured, not reading:
XCL-BT-034is not a bug on this stack — the host D3D12 runtime creates the pipeline withDepthEnable = TRUEandDSVFormat = DXGI_FORMAT_UNKNOWNwithout an error, and with no depth target the depth test has nothing to test against, so the console's state and the PC's are the same.What I ran (throwaway test in
crates/xcl/src/hle/d3d12x/real.rs, on the device fromD3D12CreateDevice(None, D3D_FEATURE_LEVEL_12_0)ofmain@c160d86), building a graphics PSO from the module's own dummy VS/PS, an empty root signature fromD3D12SerializeRootSignature, one R8G8B8A8_UNORM target,DSVFormat = UNKNOWN, and onlyDepthEnablediffering:An earlier attempt without a root signature returned
0x80070057for both variants, which is what made the claim look plausible; with a valid root signature both are accepted.So
stream_pipeline's D3D12 defaults (DepthEnable = TRUEwhen a stream leaves theDEPTH_STENCILsubobject out) are also the PC's defaults (D3D12_DEPTH_STENCIL_DESC), and a pipeline with no depth target draws the same either way. The debug layer may still warn about it, but nothing in the runtime or the driver needs the translation, so there is nothing to fix (and I did not open a PR for it).Hardware / software: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 MSVC, DXC 1.9.2609.5, debug build.
AI use: OpenCode, Gemini 4 Neon — wrote the throwaway probe, ran it, and removed it; the branch was dropped.
@AC-Storm-YT on GitHub · 2026-11-24 19:45 UTC · original
Independent hardware measurements for XCL-BT-002, -010 and -020. The instructions ran natively on RDNA2 silicon and were compared with XCL
mainc160d86. They agree with the rules given earlier in this thread, and they come from my own runs, not from Leonida's documents.Setup
gfx1036), AMD driver 32.0.21045.29003, Windows 11 Pro 26200. These are OpenCL C kernels with inline RDNA assembly, built by the driver's OpenCL (3679.0, PAL, LC). Each lane loads with its ownoffen/idxenVGPR from a V# that the kernel builds ins[20:23](RESOURCE_LEVEL= 1, identityDST_SEL).translateandrunner::run(the default HLSL path, notXCL_DIRECT_DXIL) on an RX 9070 XT (driver 32.0.32029.2010), wave32.XCL-BT-020:
buffer_load_format_d16_*: confirmed, all three partsThe test runs every 16-bit value (65,536). The 16-bit formats sit in the low half of each dword, with junk in the high half. vdst is preset to
0x5A5A0000, or0x00005A5Aford16_hi_x.d16_x(16_UNORM / 16_SNORM / 16_FLOAT / 16_UINT / 32_UINT / 32_SINT)d16_hi_x32_UINTabove 0xFFFF (0x10000,70000,0x80000000)0xFFFF(saturates)0x0000,0x1170,0x0000(truncates)32_SINT(0x8000,0x10000,0x80000000,0xFFFF7FFF)0x7FFF,0x7FFF,0x8000,0x80000x8000,0x0000,0x0000,0x7FFF16_UNORM→ f16v / 65535rounded once to nearest-even: 65,536 / 65,5360x0801: hw0x2801, XCL0x2800)16_SNORM→ f1616_FLOATsignaling NaN (0x7C01..)0x7E01..), 1,022 values: the f16 → f32 → f16 path of XCL-BT-025On UNORM / SNORM: rounding once versus going through f32 differs for only 2 values in each format (
0xFFAF,0xFFEFfor UNORM;0x7FF7,0x8009for SNORM), exactly as the audit says. Most of XCL's differences on this adapter are instead 1 f16 ulp from the conversion itself.XCL-BT-010: invalid format codes: confirmed
buffer_load_format_xwith V# formats 78, 80, 100 and 127 returns 0 on the hardware. Format 77 reads the data, as a control. XCL reads the data for format 80, as32_32_32_32_FLOAT.Also: with V# format 0 (INVALID), even an untyped
buffer_load_dwordreturns 0 on the hardware. XCL reads the data. I can't tell whether titles ever build raw buffer descriptors with format 0.XCL-BT-002: bounds by
OOB_SELECT: confirmedbuffer_load_dword, where a lane "loads" if it gets the data rather than 0:OOB_SELECToffset + 4 <= strideidxen, N 3, stride 16index < Nidxen offen, N 3, stride 16offset + 4 <= strideidxen, soffset 8 or 16idxen offenindex < NonlyN != 0offset + soffset + 4 <= Nidxen, N 40, stride 16index * stridenot checkedXCL on the same raw N = 18, soffset 8 load reads offsets 0..12 (4 lanes); the hardware reads 2.
Not tested
buffer_store_format_d16_*, and stores with invalid formats.tbuffer_load_format_d16_*(mytbufferencoding returned 0 everywhere, so I've left it out),s_buffer_load, and formats other than those named.crates/xcl/srcchanges, which need a smoke run on a title I don't have.AI use
@ddaikodaiko on GitHub · 2026-11-24 20:15 UTC · original
finding: the direct DXIL translator still has the
image_sample_oimplicit-LOD bug that #229 fixed in the HLSL path.crates/xcl/src/gpu/dxil/lower_image.rs:482-520rounds the implicit LOD, takes that mip's dimensions (get_dimensions(..., Some(level))), divides the 6-bit offset by them and adds the result to the coordinate before a singlesample; a pixel shader with a linear mip filter blends two mips, so the second one is read with the offset in the rounded mip's texels — the same0.5 texelerror the HLSL fix describes.The HLSL form (
gpu/recomp/emit.rs,texel_offset/sample_coord/moved_coords, PR #229) samples each mip withSampleLevelat its own size and blends by the LOD fraction when it is exact (MIP_FILTER linear, not anisotropic, and LOD >= 1 or min = mag filter) and keeps the single sample otherwise. Porting that to the direct translator is not just moving the code: it needs the S# words first —lower_image.rsonly reads S# word 3 (s3 & 0xFFF, the sampler heap index) and never reads XY_MIP_FILTER / XY_MAX_ANISOTROPY / XY_MIN_MAG filters from word 2, which the decision needs.Test:
gpu_ps_image_sample_offset_implicit_lod_between_mips(LOD 0.25 between 8x8 and 4x4, offset +1) withXCL_DIRECT_DXIL=1; the HLSL path passes it, the direct one should show the second mip a texel off. Needs a GPU, no game files. I have no port for this one yet.@b3IKK on GitHub · 2026-11-24 20:20 UTC · original
Two more entries checked against the code at
main@c160d86— both already handled, so nobody needs to write a fix (and a reviewer does not need to re-derive it):XCL-BT-004(DirectStorage,source_size < destination_sizeon an uncompressed request):Request::checkrefuses it at enqueue —crates/xcl/src/hle/dstorage.rs:730-736:and
queue_enqueue_requestrunscheckbefore anything is stored (dstorage.rs:1301), soexecutenever sees a request whose payload is shorter thandestination_sizeon that path; the test atdstorage.rs:1540pins it (check(false) == Err(E_DESTINATION_SIZE)). The panic / over-read would need a second entry point intoexecute; there is none.XCL-BT-006(status array slots startE_PENDING): they startS_OK—dstorage.rs:622-623:(
XCL-BT-034from the same list is also not a defect — measured on the host runtime, see my earlier comment.)The rest of the list I have gone through so far turned up real bugs, and those have PRs:
XCL-BT-035#1733,XCL-BT-032#1746,XCL-BT-033#1740,XCL-BT-036#1716,XCL-BT-037#1726,XCL-BT-038#1720,XCL-BT-040#1610,XCL-BT-041#1753.Hardware / software: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 MSVC, DXC 1.9.2609.5.
AI use: OpenCode, Gemini 4 Neon — read the two paths and wrote this up.
@b3IKK on GitHub · 2026-11-24 20:44 UTC · original
XCL-BT-024is not a bug as written (checked atmain@4178e88). The two index paths do different things, and neither renders stale indices:draw_indexed_x(list_x.rs:3559-3578) callsgpu_va(..., "DrawIndexedX indices", false)— no mirror. For a title address outside unified memory and outside any window,gpu_vafalls throughmirrored()(skipped:mirror == false) tobind::allocate_upload_memory+copy_nonoverlapping(list_x.rs:3281-3293), i.e. a fresh copy into the list's arena at every draw, made from the title's memory as it is then. The arena is a per-list bump allocator (bind.rs,s.arena.take), so the next allocation does not reuse the block.ia_set_index_buffer_x,list_x.rs:3539-3555) gets the mirror (mirror = true), and the PC-side indexed draws (bind.rs:404,draw_indexed_instanced) sync it per draw withsync_title_buffers(this, Some((first_index, indices, base_vertex)), …), which copies the range read from the title's memory into the mirror (list_x.rs:3349-3390).The one place a mirror is not re-synced is the fallback copy when
mirror_ofhas no room (2 GiB of mirrors,list_x.rs:3326-3332): that is logged as "bound as a copy made at the bind, which later writes do not reach", i.e. a stated limit of a full mirror table, not the DrawIndexedX path.XCL-BT-031from the same batch was real and is #1787.Hardware / software: NVIDIA GeForce RTX 5080 (driver 32.0.16.1088), AMD Ryzen 9 9950X3D, Windows 11 10.0.26300, Rust 1.100.0 MSVC, DXC 1.9.2609.5.
AI use: OpenCode, Gemini 4 Neon — read both index paths and wrote this up.
@ddaikodaiko on GitHub · 2026-11-24 23:48 UTC · original
Update on the direct-DXIL side of the three items in this report (RTX 3060 Ti, driver 32.0.16.1088, DXC 1.8.2502.11, branches rebased on
mainb9b6ea6):OOB_SELECT+s_buffer_load) and BT-010 (invalid buffer formats 78-127): verified before, in both translators.v_pack_b32_f16withabs/neg): now also verified in both. HLSL passes;XCL_DIRECT_DXIL=1passes; with only the direct port (7610fa0) reverted the test fails withlane 0: -1.0, |-2.0|.The earlier script's negative control (
upstream/main+XCL_DIRECT_DXIL=1) was misleading:upstream/mainhas no such test, socargo test <name>ran zero tests and exited 0. Reverting only the direct-port commit is the real control; it fails in both cases above.No PRs from me (DeepSeek rule), but the branches and per-commit patches are ready for a person or another model to take upstream.
@Decodere on GitHub · 2026-11-25 00:13 UTC · original
Taking
XCL-BT-012(pixel shaderEXPVMvalid-mask handling incrates/xcl/src/gpu/recomp/emit.rsandcrates/xcl/src/gpu/dxil/lower_gfx.rs):ENC_EXPVMbit soVM=1overwritesxcl_live/live_varwith currentEXECandVM=0leaves it unchanged whenever the pixel shader has anyVM=1export (preserving theDONE=1fallback only when noVM=1export exists), with HLSL + Direct DXIL GPU pixel-shader draw tests on RTX 4060.AI use: Google Antigravity (Gemini 4 Neon).
@Decodere on GitHub · 2026-11-25 01:02 UTC · original
Taking
XCL-BT-015(StreamConfig::from_xma2_wfxmulti-stream stereo/mono layout formula incrates/xcl/src/hle/xma2/mod.rs):num_streams <= channels <= num_streams * MAX_CHANNELS_PER_STREAMand assignstereo = channels - num_streams2-channel streams followed by 1-channel streams (fixing 5.1 4-stream[2, 2, 1, 1], 4.0 3-stream[2, 1, 1], 7.1 5/6-stream, etc.), with unit tests covering valid and invalid layouts.AI use: Google Antigravity (Gemini 4 Neon).
@Decodere on GitHub · 2026-11-25 01:27 UTC · original
Taking the Direct DXIL parity follow-up for
XCL-BT-026(crates/xcl/src/gpu/dxil/lower_mem.rsandcrates/xcl/src/gpu/recomp/tests.rs, following merged#1929which updated HLSLemit.rs):UINT(ty == 4) andSINT(ty == 5) forw < 32inLw::fmt_encode, switch16_16_FLOAT/11_11_10_FLOATencoding tof16_rtz, and add Direct DXIL GPU regression tests on RTX 4060.AI use: Google Antigravity (Gemini 4 Neon).
@fixgep on GitHub · 2026-11-25 18:12 UTC · original
XCL-BT-008(async PSO COM lifetime retention across command lists andlate_releaseretirement): opened PR #2417 with multi-threaded race and queue-retirement tests.AI use: Antigravity (Gemini 4 Hydrogen).