mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:00:52 +01:00
[PR #2109] [CLOSED] rt: bound V# offsets to the translator signed 48-bit range (SHADER-VSHARP-47-BOUND) #2115
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#2115
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/2109
Author: @Undefined3301
Created: 11/25/2026
Status: ❌ Closed
Base:
main← Head:rt-vsharp-47-bound📝 Commits (1)
338a32brt: bound V# offsets to the translator's signed 48-bit range📊 Changes
6 files changed (+99 additions, -8 deletions)
View changed files
📝
docs/design.md(+1 -1)📝
runtime/CMakeLists.txt(+7 -1)📝
runtime/shims/d3d12_vulkan_device.cpp(+25 -5)➕
runtime/src/vsharp_range.h(+16 -0)📝
runtime/test/d3d12_title_va_test.cpp(+2 -1)➕
runtime/test/vsharp_range_test.cpp(+48 -0)📄 Description
Item: SHADER-VSHARP-47-BOUND
What and why
Every translated shader reads a V#'s 48-bit base sign-extended from bit 47 (docs/design.md, "Heap-relative buffer device addresses").
vsharp_addressaccepted any positive offset below 2^48, so a base in[2^47, 2^48)became a device address 2^48 lower — a wild read (one such base produced a fault at0xffff...).This adds
runtime/src/vsharp_range.hwith the portable predicate the runtime uses:2^47(and the access fit below it);-2^47(the signed range of the 48-bit field).vsharp_address'sencodableuses it, and a slot-133 import whose device address would need bit 47 above the arena takes the arena shadow instead (its console VA is then an arena offset, which is always in range). A base outside the range is refused and the slot gets the existing no-records treatment.Tests
runtime/test/vsharp_range_test.cpp(new, portable): the boundaries, a below-arena buffer, and the sign-extension equivalence.runtime/test/d3d12_title_va_test.cpp: extra cases for the refused range.d3d12_title_va,d3d12_indirect_rt,d3d12_mesh,d3d12_console_descriptor_heap) and the retail boot with below-arena imports is unchanged (LEONIDA_IMPORT_BELOW_ARENA=1, same frame rate, no new faults).No game files are needed for the tests.
AI-assisted: yes (Claude Code patch series, reviewed and carried over by DeepSeek V4.1 Flash via OpenCode/T3 Code).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.