mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:00:52 +01:00
[PR #1328] d3d12: require a console heap address to be 64 KiB aligned before slot 14 reads it #1358
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#1358
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1328
Author: @robot00f
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:fix/console-heap-alignment📝 Commits (1)
a55007bd3d12: require a console heap address to be 64 KiB aligned before slot 14 reads it📊 Changes
2 files changed (+33 additions, -1 deletions)
View changed files
📝
runtime/shims/d3d12_xs_device.cpp(+6 -1)📝
runtime/test/d3d12_console_descriptor_heap_test.cpp(+27 -0)📄 Description
Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7145591230 (ID
D3D12-CONSOLE-HEAP-ALIGN; fixes thed3d12_subgroupSegFault in #1150)d3d12_subgroupcrashed deterministically (3/3) inDevice::CreateRenderTargetView, writing the 16-byte view to a handle whose value was the ASCII textps_probe-- the bytes of a shader name.Cause
Device slot 14 reads a console descriptor heap as a PC
D3D12_DESCRIPTOR_HEAP_DESCwith an address at +0x10 and a size at +0x18, and keepsconsole_heap_range_plausible()to tell that layout from a PC desc whose trailing words are whatever the caller's next local holds. That guard checked only that the size equalledNumDescriptors * 32. The test's neighbour happened to supply exactly 32, so the garbage word was accepted as a console address,GetCPUDescriptorHandleForHeapStartreturned it, and the first view write went to0x65626f72705f7370.Fix
The predicate now also requires the address to be 64 KiB aligned -- what a heap range the title supplies always is, and what a neighbouring local almost never is. Nothing else changes: a real console heap and an ordinary PC heap both behave as before.
d3d12_console_descriptor_heap_testgains the exact case: a desc whose following words are0x65626f72705f7370with a matching size, asserting the handle does not become that word.Tested
d3d12_subgroup_test: SegFault 3/3 before, passes 3/3 after.d3d12_console_descriptor_heap_test3/3 (covers the aligned console path through the proxy).d3d12_clear_test,d3d12_descriptor_test,d3d12_typeless_rtv_test,device_proxy_test,xs_proxy_mock_testall pass.check_no_game_data.py-> exit 0.Not tested: the retail executable's slot 14 call sites (no game files run here). The alignment is an assumption about console heap VAs; if a measurement ever shows a title passing an unaligned one, this is where it would show.
GPUs tested: NVIDIA GPU (Pascal class, 4 GB), driver 582.28, Windows 10 19045.
AI-assisted: yes (OpenCode, DeepSeek V4.1 Flash)
Checklist
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.