You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
slot 14: a normal 16-byte descriptor heap description is read as the console layout, and d3d12_descriptor SEGFAULTs #3
Measured on Windows 11, MSVC 14.44.35207, RTX 5070 Ti, driver 32.0.16.1742, on a60e5eab5 with the build fixes that are now in main here (acphal trailing words, the registered slot-14 handler). The detection block below is byte-identical at main@2e4715746, so this still applies.
What happens
proxy_create_descriptor_heap (runtime/shims/d3d12_xs_device.cpp) decides that a call uses the console layout when the 16 bytes after the PC description are readable and the word there is non-zero:
A normal 16-byte D3D12_DESCRIPTOR_HEAP_DESC on the stack or inside a struct is almost always followed by readable, non-zero memory, so the read picks up whatever is there as a console VA. The heap then reports that value as GetCPUDescriptorHandleForHeapStart(), and the first Create*View writes 32 bytes through it.
What it does to a test
ctest -R ^d3d12_descriptor$ SEGFAULTs. d3d12_descriptor_test.cpp:346 creates the device proxy, and every later CreateDescriptorHeap(&heap_desc, ...) goes through it. The log shows the console path taken for a heap built from a normal desc:
[rt] d3d12: descriptor heap uses console address/size (not backed by title memory) 0
...
196 - d3d12_descriptor (SEGFAULT)
d3d12_console_descriptor_heap_test passes its assertions now but the process still exits with an access violation after printing ok (exit 139 / 0xC0000005), which is worth a separate look.
A direction, for you to choose
Readability is not evidence of the console layout. Positive checks could be: the range [address, address + size) is MEM_COMMIT and writable, size == NumDescriptors * 32, and/or an explicit opt-in for the ABI path, so a normal desc can never enter it.
Nothing here quotes the executable: only test names, a file:line and pass/fail.
Follow-up measurement on main@2e4715746, same box as above (Windows 11, MSVC 14.44.35207, RTX 5070 Ti, driver 32.0.16.1742). The tree builds here as it stands, 154 targets, no source changes: vcvars64.bat cannot run on this machine because it calls reg.exe, so I set INCLUDE/LIB from the SDK at E:\Windows Kits\10 and built with Ninja.
Correction to the last paragraph
d3d12_console_descriptor_heap_test now exits 0 here, so the "still exits 139 after printing ok" note does not apply to this tree - heap_proxy_real_heap() and reading the wrapped heap's PC method is what fixed it. d3d12_descriptor is unaffected and still SEGFAULTs, and its log shows the console path taken for an ordinary heap:
[rt] d3d12_xs: device slot 14 (CreateDescriptorHeap) first call
[rt] d3d12: descriptor heap uses console address/size (not backed by title memory) 2
[rt] d3d12_xs: heap slot 9 (GetCPUDescriptorHandleForHeapStart) first call
<Segmentation fault>
A guard that works
The console layout carries a size as well as an address, and the size is exactly 32 bytes per descriptor. A PC desc's trailing words are whatever the caller holds next; they do not encode NumDescriptors * 32. Requiring that agreement rejects the false positive without making any claim about the address:
diff --git a/runtime/shims/d3d12_xs_device.cpp b/runtime/shims/d3d12_xs_device.cpp
index 14a4b38ff..1045b86fb 100644
--- a/runtime/shims/d3d12_xs_device.cpp+++ b/runtime/shims/d3d12_xs_device.cpp@@ -1563,6 +1563,18 @@ HRESULT proxy_unwrapping_call(DeviceProxy* self, std::uint64_t a1, std::uint64_t
return static_cast<HRESULT>(static_cast<std::uint32_t>(forward_device<Slot>(self, r1, r2, r3, r4, a5)));
}
+// A console descriptor heap carries a size as well as an address, and that size is 32 bytes per descriptor. A PC+// desc's trailing words are whatever the caller holds next; they do not encode NumDescriptors * 32, so this+// separates the two layouts without guessing anything about the address itself.+static bool console_heap_range_plausible(const D3D12_DESCRIPTOR_HEAP_DESC* desc, std::uint64_t address,+ std::uint64_t size) {+ constexpr std::uint64_t kConsoleDescriptorSize = 32;+ if (address == 0 || size == 0) return false;+ if (desc->NumDescriptors == 0 || desc->NumDescriptors > (0xFFFFFFFFull / kConsoleDescriptorSize)) return false;+ if (size != static_cast<std::uint64_t>(desc->NumDescriptors) * kConsoleDescriptorSize) return false;+ return true;+}+
static bool readable_range(const void* ptr, std::size_t bytes) {
if (!ptr || !bytes) return false;
const auto* p = static_cast<const std::uint8_t*>(ptr);
@@ -1602,9 +1614,10 @@ HRESULT proxy_create_descriptor_heap(DeviceProxy* self, const D3D12_DESCRIPTOR_H
std::uint64_t size = 0;
std::memcpy(&address, tail, sizeof(address));
std::memcpy(&size, bytes + sizeof(D3D12_DESCRIPTOR_HEAP_DESC) + sizeof(address), sizeof(size));
- // Console-extended slot 14 (issue #313): address/size follow the PC desc. Only take this path when a- // non-zero console VA is present; normal PC 16-byte descs never enter it.- if (address != 0) {+ // Console-extended slot 14 (issue #313): address/size follow the PC desc. A non-zero word is not evidence+ // of that layout - the bytes after a PC desc are whatever the caller holds next, and they are almost+ // always readable and non-zero. The size has to agree with the descriptor count for the path to be taken.+ if (console_heap_range_plausible(desc, address, size)) {
const ConsoleDescriptorHeapHandler handler =
g_console_descriptor_heap.load(std::memory_order_acquire);
if (handler) {
I first also required the range to be a committed, writable VirtualQuery region. That is a true property of the console layout, but it rejects d3d12_console_descriptor_heap_test's synthetic address, and a console heap whose VA is not backed by title memory would fail it too, so I dropped it. Size alone is enough for the test corpus here.
Numbers, same tree, only this guard toggled
tree
ctest
failed
main@2e4715746
278/300
22
main@2e4715746 + guard
296/300
4
d3d12_descriptor goes from exit 139 to exit 0. The 18 tests that stop failing are the ones that build a heap through the proxy and then write through the handle - d3d12_draw, d3d12_compute, d3d12_msaa_draw, d3d12_depth24_draw, d3d12_m2_formats, d3d12_f16_halves, d3d12_subgroup, d3d12_translated_draw, d3d12_bindless_churn, and the rest of that set.
The four that still fail are the same with and without the guard, and look unrelated: root_sig (blob helper rewrites an all-zero-checksum Xbox blob and keeps its zero checksum; shim deserializer accepts an all-zero-checksum Xbox blob with the high byte cleared), d3d12_com and d3d12_vulkan_device (ExecuteCommandLists failed: a list is not closed / invalid copy or resolve), d3d12_depth_resolve.
I cannot open a PR against this repository: the only credential I have is a fine-grained token, and creating a fork is 403 Resource not accessible by personal access token. The diff above applies to main@2e4715746 as a single commit if you would rather take it that way.
Nothing here quotes the executable: test names, a file:line, and pass/fail only.
A data point from another machine: on main 1c93c86 this does not reproduce here. Windows 11 Home build 26300, MSVC 14.44 / RelWithDebInfo built with scripts\build_runtime.ps1, NVIDIA GeForce RTX 4080, driver 621.24.
ctest -R descriptor: d3d12_descriptor, d3d12_console_descriptor_heap, d3d12_set_descriptor_heaps, descriptor_table, gfx10_descriptors and vk_descriptor_bench_selftest all pass, 6 of 6, no SEGFAULT. The same six passed on a build of d42773d earlier today.
This is one GPU and one driver, and I did not go back to a60e5ea or 2e47157 to see the crash first, so it shows the tests are green on current main here, not which change fixed it. Leaving it to a maintainer whether to close.
AI-assisted (Claude Code built, ran the tests and wrote this comment).
The fix for this is #4 ("only take the console slot-14 layout when the descriptor size agrees"), merged as 30daa69 and on main; the coordination issue lists it as "slot-14 console-layout false positive (#3, fixed by #4)". #4 has no Fixes #3 line, which is likely why this stayed open, and quartz-heron-58 reports it no longer reproduces on 1c93c86 (RTX 4080).
I have not rebuilt the runtime myself (no MSVC on this machine), so I can't add a fresh measurement; @yyc160, if ctest -R descriptor is green for you on current main, this can be closed.
The false positive is still reachable after #4 for one-descriptor heaps: on main3295055 (MSVC 19.44 RelWithDebInfo, RTX 5070 Ti) d3d12_draw SEGFAULTs because its RTV desc is followed by the words 1, 32, which pass the size check. Fix and regression case in #1148.
Current main0d80bc5df still has the tail-null-page hole in slot 14's console_heap_range_plausible (it rejects only address == 0). #1148's low-address guard (address < 0x10000) closes it.
I applied #1148's d3d12_xs_device.cpp hunk onto 0d80bc5df and ran the descriptor/draw tests on Windows 11 Pro / MSVC RelWithDebInfo / NVIDIA RTX 3080 Ti (driver 616.64): d3d12_draw, d3d12_console_descriptor_heap, d3d12_descriptor and d3d12_set_descriptor_heaps all pass.
On this machine the original SEGFAULT does not reproduce on clean main either (stack-layout dependent), so this is a non-regression check; madhyn reproduced it on Wine / RTX 3060 Ti. Once #1148 is rebased (its test hunk conflicts with main's reworked check_xs_proxy_slot14) and merged, this can close.
Not stale: the fix exists but is not on main. #1148 (Luna-OS) carries it — f6584ed80, D3D-SLOT14-TAIL-NULL-PAGE — rejecting an address in the first 64 KiB as a console heap, with d3d12_console_descriptor_heap_test covering the stray-words case from this report. #1148 is OPEN and CONFLICTING, so the SEGFAULT is still reproducible on main 9e7720c9e; the action item is the rebase of #1148, not another fix.
Activity
yyc160 commentedon Nov 24, 2026
Follow-up measurement on
main@2e4715746, same box as above (Windows 11, MSVC 14.44.35207, RTX 5070 Ti, driver 32.0.16.1742). The tree builds here as it stands, 154 targets, no source changes:vcvars64.batcannot run on this machine because it callsreg.exe, so I setINCLUDE/LIBfrom the SDK atE:\Windows Kits\10and built with Ninja.Correction to the last paragraph
d3d12_console_descriptor_heap_testnow exits 0 here, so the "still exits 139 after printing ok" note does not apply to this tree -heap_proxy_real_heap()and reading the wrapped heap's PC method is what fixed it.d3d12_descriptoris unaffected and still SEGFAULTs, and its log shows the console path taken for an ordinary heap:A guard that works
The console layout carries a size as well as an address, and the size is exactly 32 bytes per descriptor. A PC desc's trailing words are whatever the caller holds next; they do not encode
NumDescriptors * 32. Requiring that agreement rejects the false positive without making any claim about the address:I first also required the range to be a committed, writable
VirtualQueryregion. That is a true property of the console layout, but it rejectsd3d12_console_descriptor_heap_test's synthetic address, and a console heap whose VA is not backed by title memory would fail it too, so I dropped it. Size alone is enough for the test corpus here.Numbers, same tree, only this guard toggled
main@2e4715746main@2e4715746+ guardd3d12_descriptorgoes from exit 139 to exit 0. The 18 tests that stop failing are the ones that build a heap through the proxy and then write through the handle -d3d12_draw,d3d12_compute,d3d12_msaa_draw,d3d12_depth24_draw,d3d12_m2_formats,d3d12_f16_halves,d3d12_subgroup,d3d12_translated_draw,d3d12_bindless_churn, and the rest of that set.The four that still fail are the same with and without the guard, and look unrelated:
root_sig(blob helper rewrites an all-zero-checksum Xbox blob and keeps its zero checksum; shim deserializer accepts an all-zero-checksum Xbox blob with the high byte cleared),d3d12_comandd3d12_vulkan_device(ExecuteCommandLists failed: a list is not closed/invalid copy or resolve),d3d12_depth_resolve.I cannot open a PR against this repository: the only credential I have is a fine-grained token, and creating a fork is
403 Resource not accessible by personal access token. The diff above applies tomain@2e4715746as a single commit if you would rather take it that way.Nothing here quotes the executable: test names, a file:line, and pass/fail only.
quartz-heron-58 commentedon Nov 24, 2026
A data point from another machine: on main 1c93c86 this does not reproduce here. Windows 11 Home build 26300, MSVC 14.44 / RelWithDebInfo built with
scripts\build_runtime.ps1, NVIDIA GeForce RTX 4080, driver 621.24.ctest -R descriptor:d3d12_descriptor,d3d12_console_descriptor_heap,d3d12_set_descriptor_heaps,descriptor_table,gfx10_descriptorsandvk_descriptor_bench_selftestall pass, 6 of 6, no SEGFAULT. The same six passed on a build of d42773d earlier today.This is one GPU and one driver, and I did not go back to a60e5ea or 2e47157 to see the crash first, so it shows the tests are green on current main here, not which change fixed it. Leaving it to a maintainer whether to close.
AI-assisted (Claude Code built, ran the tests and wrote this comment).
MoonEyes commentedon Nov 24, 2026
The fix for this is #4 ("only take the console slot-14 layout when the descriptor size agrees"), merged as 30daa69 and on
main; the coordination issue lists it as "slot-14 console-layout false positive (#3, fixed by #4)". #4 has noFixes #3line, which is likely why this stayed open, and quartz-heron-58 reports it no longer reproduces on 1c93c86 (RTX 4080).I have not rebuilt the runtime myself (no MSVC on this machine), so I can't add a fresh measurement; @yyc160, if
ctest -R descriptoris green for you on currentmain, this can be closed.AI-assisted (Claude Code).
Luna-OS commentedon Nov 24, 2026
The false positive is still reachable after #4 for one-descriptor heaps: on
main3295055(MSVC 19.44 RelWithDebInfo, RTX 5070 Ti)d3d12_drawSEGFAULTs because its RTV desc is followed by the words1, 32, which pass the size check. Fix and regression case in #1148.BubsMcgee commentedon Nov 25, 2026
Current
main0d80bc5dfstill has the tail-null-page hole in slot 14'sconsole_heap_range_plausible(it rejects onlyaddress == 0). #1148's low-address guard (address < 0x10000) closes it.I applied #1148's
d3d12_xs_device.cpphunk onto0d80bc5dfand ran the descriptor/draw tests on Windows 11 Pro / MSVC RelWithDebInfo / NVIDIA RTX 3080 Ti (driver 616.64):d3d12_draw,d3d12_console_descriptor_heap,d3d12_descriptorandd3d12_set_descriptor_heapsall pass.On this machine the original SEGFAULT does not reproduce on clean main either (stack-layout dependent), so this is a non-regression check; madhyn reproduced it on Wine / RTX 3060 Ti. Once #1148 is rebased (its test hunk conflicts with main's reworked
check_xs_proxy_slot14) and merged, this can close.AI-assisted.
BubsMcgee commentedon Nov 25, 2026
Not stale: the fix exists but is not on main. #1148 (Luna-OS) carries it —
f6584ed80, D3D-SLOT14-TAIL-NULL-PAGE — rejecting an address in the first 64 KiB as a console heap, withd3d12_console_descriptor_heap_testcovering the stray-words case from this report. #1148 is OPEN and CONFLICTING, so the SEGFAULT is still reproducible on main9e7720c9e; the action item is the rebase of #1148, not another fix.