D3D12.X: TOCTOU use-after-free on RTVS resource pointer in present::note_execute #2371
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?
Imported from ivall/xcl. Originally posted by ahmetbagci8 on 2026-11-25T17:32:18Z.
Summary
In
crates/xcl/src/hle/d3d12x/present.rs,note_executereads a raw COM resource pointerresout ofRTVSand dropsRTVS.lock()without callingadd_ref(res)(lines 276-288):Meanwhile,
note_rtv(lines 158-171) removes or replaces entries inRTVSunderRTVS.lock()and callsrelease(o):If another thread calls
note_rtv(h, ...)betweennote_executereleasingRTVS.lock()(line 276) and callingbackbuffer_like(res)(line 278) /add_ref(res)(line 284), andRTVSheld the last reference,resis freed beforenote_executedereferences its COM vtable (TOCTOU use-after-free).Suggested fix
Acquire a reference while still holding
RTVS.lock(), and release it on early return or ifCANDIDATEalready holdsres:Not tested
082944135cd2b96288470a595861fa608eee08dcwithout a new runtime test.AI use
present.rsand drafted this report; the author reviewed it before posting.upstream-sync referenced this issue2026-11-26 02:07:49 +00:00
upstream-sync referenced this issue2026-11-26 04:07:30 +00:00