[PR #4] [MERGED] d3d12_xs: only take the console slot-14 layout when the descriptor size agrees #60

Closed
opened 2026-11-26 20:16:40 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/4
Author: @yyc160
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism

Base: main ← Head: slot14-range-guard


📝 Commits (1)

  • 37246f1 d3d12_xs: only take the console slot-14 layout when the descriptor size agrees

📊 Changes

1 file changed (+16 additions, -3 deletions)

View changed files

📝 runtime/shims/d3d12_xs_device.cpp (+16 -3)

📄 Description

Fixes the false positive in #3.

proxy_create_descriptor_heap treated a readable, non-zero word after the PC description as a console address. A normal 16-byte D3D12_DESCRIPTOR_HEAP_DESC is almost always followed by readable, non-zero memory, so every ordinary heap created through the proxy entered the console path and reported that word as its CPU handle; the first Create*View then wrote through it.

The console layout 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 and do not encode NumDescriptors * 32, so requiring the agreement separates the two layouts without guessing anything about the address.

I also tried requiring 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 left it out. Size alone is enough for the corpus here.

Measurements

Windows 11, MSVC 14.44.35207, Windows SDK 10.0.26100.0, Ninja, RTX 5070 Ti with driver 32.0.16.1742. Base is main@2e4715746; the only difference between the two rows is this commit.

tree ctest failed
main@2e4715746 278/300 22
main@2e4715746 + this commit 296/300 4

d3d12_descriptor goes from exit 139 to exit 0. The 18 tests that stop failing are the ones that create a heap through the proxy and then write through the handle:

d3d12_vulkan_device  d3d12_f16_halves   d3d12_m2_formats   d3d12_msaa_draw
d3d12_depth24_draw   d3d12_subgroup     d3d12_translated_draw
d3d12_m2_textured    d3d12_m3_frame     d3d12_m3_first_pass
d3d12_m4_compute     d3d12_buffer_uav   d3d12_compute      d3d12_draw
d3d12_set0_compute   d3d12_bindless_churn  d3d12_bindless_churn_validated
d3d12_present

The four that still fail fail identically with and without this change, and are unrelated to descriptor heaps:

  • root_sig: FAIL blob helper rewrites an all-zero-checksum Xbox blob and keeps its zero checksum, FAIL shim deserializer accepts an all-zero-checksum Xbox blob with the high byte cleared
  • d3d12_com, d3d12_vulkan_device: ExecuteCommandLists failed: a list is not closed; nothing was submitted and invalid copy or resolve; nothing was submitted
  • d3d12_depth_resolve

Nothing here quotes the executable: test names, a file:line and pass/fail only.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/4 **Author:** [@yyc160](https://github.com/yyc160) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `slot14-range-guard` --- ### 📝 Commits (1) - [`37246f1`](https://github.com/ubiquitarianism/leonida/commit/37246f11d1622e6959c19874000ddc020fa2bf79) d3d12_xs: only take the console slot-14 layout when the descriptor size agrees ### 📊 Changes **1 file changed** (+16 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/d3d12_xs_device.cpp` (+16 -3) </details> ### 📄 Description Fixes the false positive in #3. `proxy_create_descriptor_heap` treated a readable, non-zero word after the PC description as a console address. A normal 16-byte `D3D12_DESCRIPTOR_HEAP_DESC` is almost always followed by readable, non-zero memory, so every ordinary heap created through the proxy entered the console path and reported that word as its CPU handle; the first `Create*View` then wrote through it. The console layout 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 and do not encode `NumDescriptors * 32`, so requiring the agreement separates the two layouts without guessing anything about the address. I also tried requiring 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 left it out. Size alone is enough for the corpus here. ## Measurements Windows 11, MSVC 14.44.35207, Windows SDK 10.0.26100.0, Ninja, RTX 5070 Ti with driver 32.0.16.1742. Base is `main@2e4715746`; the only difference between the two rows is this commit. | tree | ctest | failed | |---|---|---| | `main@2e4715746` | 278/300 | 22 | | `main@2e4715746` + this commit | 296/300 | 4 | `d3d12_descriptor` goes from exit 139 to exit 0. The 18 tests that stop failing are the ones that create a heap through the proxy and then write through the handle: ``` d3d12_vulkan_device d3d12_f16_halves d3d12_m2_formats d3d12_msaa_draw d3d12_depth24_draw d3d12_subgroup d3d12_translated_draw d3d12_m2_textured d3d12_m3_frame d3d12_m3_first_pass d3d12_m4_compute d3d12_buffer_uav d3d12_compute d3d12_draw d3d12_set0_compute d3d12_bindless_churn d3d12_bindless_churn_validated d3d12_present ``` The four that still fail fail identically with and without this change, and are unrelated to descriptor heaps: - `root_sig`: `FAIL blob helper rewrites an all-zero-checksum Xbox blob and keeps its zero checksum`, `FAIL shim deserializer accepts an all-zero-checksum Xbox blob with the high byte cleared` - `d3d12_com`, `d3d12_vulkan_device`: `ExecuteCommandLists failed: a list is not closed; nothing was submitted` and `invalid copy or resolve; nothing was submitted` - `d3d12_depth_resolve` Nothing here quotes the executable: test names, a file:line and pass/fail only. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:16:40 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#60
No description provided.