mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:30:52 +01:00
[PR #1717] [CLOSED] d3d12_vulkan: copy_guarded and hash_guarded catch page faults under clang-cl (RT-CLANG-EHA) #1731
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#1731
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/1717
Author: @ImLele69
Created: 11/25/2026
Status: ❌ Closed
Base:
main← Head:rt-clang-eha📝 Commits (3)
291a354runtime: gta6rt builds with /EHa under clang-cl, so __try catches faults inside memcpy44e7d30runtime: gta6rt_d3d12_com builds with /EHa under clang-cl too36612c9d3d12_vulkan: copy_guarded and hash_guarded call their body through a volatile pointer instead of relying on /EHa📊 Changes
1 file changed (+43 additions, -27 deletions)
View changed files
📝
runtime/shims/d3d12_vulkan_device.cpp(+43 -27)📄 Description
Claimed in the coordination issue as: RT-CLANG-EHA — https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7158385623
What and why
copy_guardedandhash_guarded(shims/d3d12_vulkan_device.cpp) read the title's memory inside__try/__except, so that a page the title unmaps between the check and the read comes back asfalseinstead of killing the process. That holds under MSVC. Under clang-cl with/EHscit does not: clang lowersmemcpyto an intrinsic it treats as unable to throw, and loads inlined into the__tryblock (the hash, theMOVNTDQApath) are not covered either, so the__exceptnever runs.Seen on a clang-cl/xwin build under Wine 11.21 (Fedora 44, RTX 2070 SUPER), twice during the story load: a slot-133 shadow refresh copied a page xmem had just unmapped and the process died. Startup trace exception record: read of
0x7fe6bac60000inucrtbase.dll+0x171a6(memcpy), regionMEM_RESERVE/MEM_PRIVATE; with a linker map, the stack iscopy_guarded<ShadowPages::refresh< the device's submission callback <VulkanQueue::execute_now<CommandQueue::ExecuteCommandLists.Change
The bodies become
noinlinefunctions (copy_unguarded,hash_unguarded) that the guards call through avolatilefunction pointer inside the__try. clang-cl then sees a call it cannot provenothrowand covers it. No build flag changes.The first version of this PR added
/EHainstead. That did not work:/EHaongta6rtnever reached these functions, whichgta6rt_d3d12_comcompiles, and/EHaon that library or on every source does not link with clang 20 (std::variant's trivial destructor is referenced but never emitted: 155 targets failed). Those commits are undone in this branch; the diff againstmainis onlyd3d12_vulkan_device.cpp.Tested
/EHsc, under Wine 11.21: a fault from aMEM_RESERVEpage is caught through the pointer call, both viamemcpyand via aMOVNTDQAloop, and a copy from committed memory still succeeds. The same function withmemcpydirectly in the__trydies at the sameucrtbase.dlladdress as the game run.runtime/cross-builds (ninja -k 0, 0 failed) onmain3de22a190.Other
__tryusers (file_system.cpp,pe_loader.cpp,title_page_watch.h,startup_trace.h) may have the same limit under clang-cl; I have not changed or tested them here.AI-assisted: yes (Claude Code).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.