mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:20:51 +01:00
[GH-ISSUE #3] slot 14: a normal 16-byte descriptor heap description is read as the console layout, and d3d12_descriptor SEGFAULTs #1
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1
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?
Originally created by @yyc160 on GitHub (Nov 24, 2026).
Original GitHub issue: https://github.com/ubiquitarianism/leonida/issues/3
Measured on Windows 11, MSVC 14.44.35207, RTX 5070 Ti, driver 32.0.16.1742, on
a60e5eab5with the build fixes that are now inmainhere (acphal trailing words, the registered slot-14 handler). The detection block below is byte-identical atmain@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_DESCon 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 asGetCPUDescriptorHandleForHeapStart(), and the firstCreate*Viewwrites 32 bytes through it.What it does to a test
ctest -R ^d3d12_descriptor$SEGFAULTs.d3d12_descriptor_test.cpp:346creates the device proxy, and every laterCreateDescriptorHeap(&heap_desc, ...)goes through it. The log shows the console path taken for a heap built from a normal desc:d3d12_console_descriptor_heap_testpasses its assertions now but the process still exits with an access violation after printingok(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)isMEM_COMMITand 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.
@yyc160 commented on GitHub (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 commented on GitHub (Nov 24, 2026):
A data point from another machine: on main
1c93c869this does not reproduce here. Windows 11 Home build 26300, MSVC 14.44 / RelWithDebInfo built withscripts\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 ofd42773d0earlier today.This is one GPU and one driver, and I did not go back to
a60e5eab5or2e4715746to 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 commented on GitHub (Nov 24, 2026):
The fix for this is #4 ("only take the console slot-14 layout when the descriptor size agrees"), merged as
30daa6958and onmain; 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 on1c93c869(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 commented on GitHub (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 commented on GitHub (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 commented on GitHub (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.