[PR #1148] d3d12_xs: slot 14 does not take an address in the first 64 KiB as a console heap; d3d12_draw no longer SEGFAULTs (D3D-SLOT14-TAIL-NULL-PAGE) #1182

Open
opened 2026-11-26 20:20:22 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1148
Author: @Luna-OS
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: fix/slot14-tail-null-page


📝 Commits (1)

  • f6584ed d3d12_xs: slot 14 does not take an address in the first 64 KiB as a console heap (D3D-SLOT14-TAIL-NULL-PAGE)

📊 Changes

2 files changed (+31 additions, -3 deletions)

View changed files

📝 runtime/shims/d3d12_xs_device.cpp (+7 -3)
📝 runtime/test/d3d12_console_descriptor_heap_test.cpp (+24 -0)

📄 Description

Claimed in the coordination issue as: D3D-SLOT14-TAIL-NULL-PAGE (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7141490109)

Depends on: none. Touches the same function's neighbourhood as #644 (heap sync) and the same decision as the stale draft #216 (choosing the slot-14 layout per device proxy, which would remove the guess altogether); this is the minimal fix for main until that lands.

What and why

d3d12_draw SEGFAULTs on main (seen at 3295055) with MSVC RelWithDebInfo when glslang is available, so the test is built:

[rt] d3d12: descriptor heap uses console address/size (not backed by title memory) 2
249 - d3d12_draw (SEGFAULT)

It is the false positive of #3 again, past the size check #4 added. proxy_create_descriptor_heap reads the 16 bytes after a D3D12_DESCRIPTOR_HEAP_DESC as a console address/size pair when console_heap_range_plausible agrees. The test's ordinary one-entry RTV heap (runtime/test/d3d12_draw_test.cpp:351) had, measured with a temporary log at that call:

slot14 tail address=0x1 size=32 n=1

32 == 1 * 32, so the size check passed, the heap's start became 0x1, and CreateRenderTargetView wrote through it. For a one-descriptor heap a stray 32 next to the desc is not unlikely.

The fix: console_heap_range_plausible also requires the address to be at least 0x10000. Windows never maps the first 64 KiB (the lowest user-mode address is 0x10000), so no console heap address can be there. Real console addresses (0x556677880000 and 0x112233440000 in the existing test) are unaffected. d3d12_console_descriptor_heap_test gets the measured case: an RTV desc with NumDescriptors = 1 followed by 1, 32 must give an ordinary heap through the proxy.

Tested

Windows 11 Pro 26300, NVIDIA GeForce RTX 5070 Ti (621.24), MSVC 19.44.35207, Ninja, RelWithDebInfo, glslang (KhronosGroup main-tot) on PATH via Vulkan_GLSLANG_VALIDATOR_EXECUTABLE. No game files.

without the fix with the fix
d3d12_console_descriptor_heap (with the new case) Failed: stray trailing words were taken as a console heap: CPU start 0x1 Passed
d3d12_draw SEGFAULT Passed
full ctest 296/298 298/299; the one failure is d3d12_execute_indirect_validation (#504), as on main

d3d12_descriptor (the test of #3) passes in both.

GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 621.24, Windows 11 26300 (plus live WARP in the tests that use it)

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.
  • No translator rule changed.

🤖 Generated with Claude Code


🔄 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/1148 **Author:** [@Luna-OS](https://github.com/Luna-OS) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/slot14-tail-null-page` --- ### 📝 Commits (1) - [`f6584ed`](https://github.com/ubiquitarianism/leonida/commit/f6584ed80c3a9157c588151602735ed2c8411263) d3d12_xs: slot 14 does not take an address in the first 64 KiB as a console heap (D3D-SLOT14-TAIL-NULL-PAGE) ### 📊 Changes **2 files changed** (+31 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/d3d12_xs_device.cpp` (+7 -3) 📝 `runtime/test/d3d12_console_descriptor_heap_test.cpp` (+24 -0) </details> ### 📄 Description Claimed in the coordination issue as: D3D-SLOT14-TAIL-NULL-PAGE (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7141490109) Depends on: none. Touches the same function's neighbourhood as #644 (heap sync) and the same decision as the stale draft #216 (choosing the slot-14 layout per device proxy, which would remove the guess altogether); this is the minimal fix for `main` until that lands. ### What and why `d3d12_draw` SEGFAULTs on `main` (seen at `3295055`) with MSVC RelWithDebInfo when glslang is available, so the test is built: ``` [rt] d3d12: descriptor heap uses console address/size (not backed by title memory) 2 249 - d3d12_draw (SEGFAULT) ``` It is the false positive of #3 again, past the size check #4 added. `proxy_create_descriptor_heap` reads the 16 bytes after a `D3D12_DESCRIPTOR_HEAP_DESC` as a console address/size pair when `console_heap_range_plausible` agrees. The test's ordinary one-entry RTV heap (`runtime/test/d3d12_draw_test.cpp:351`) had, measured with a temporary log at that call: ``` slot14 tail address=0x1 size=32 n=1 ``` `32 == 1 * 32`, so the size check passed, the heap's start became `0x1`, and `CreateRenderTargetView` wrote through it. For a one-descriptor heap a stray `32` next to the desc is not unlikely. The fix: `console_heap_range_plausible` also requires the address to be at least `0x10000`. Windows never maps the first 64 KiB (the lowest user-mode address is `0x10000`), so no console heap address can be there. Real console addresses (`0x556677880000` and `0x112233440000` in the existing test) are unaffected. `d3d12_console_descriptor_heap_test` gets the measured case: an RTV desc with `NumDescriptors = 1` followed by `1, 32` must give an ordinary heap through the proxy. ### Tested Windows 11 Pro 26300, NVIDIA GeForce RTX 5070 Ti (621.24), MSVC 19.44.35207, Ninja, RelWithDebInfo, glslang (KhronosGroup `main-tot`) on PATH via `Vulkan_GLSLANG_VALIDATOR_EXECUTABLE`. No game files. | | without the fix | with the fix | |---|---|---| | `d3d12_console_descriptor_heap` (with the new case) | Failed: `stray trailing words were taken as a console heap: CPU start 0x1` | Passed | | `d3d12_draw` | SEGFAULT | Passed | | full `ctest` | 296/298 | 298/299; the one failure is `d3d12_execute_indirect_validation` (#504), as on `main` | `d3d12_descriptor` (the test of #3) passes in both. GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 621.24, Windows 11 26300 (plus live WARP in the tests that use it) AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. - [x] No translator rule changed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#1182
No description provided.