Repository navigation
xmem: a commit of a 64 KiB-page reservation succeeds instead of failing (EGEN-XMEM-COMMIT-PLACEHOLDER) - #8599
Open
evilclanker9000 wants to merge 1 commit into
Conversation
…ng (EGEN-XMEM-COMMIT-PLACEHOLDER)
Contributor
|
Tested
AI-assisted. No game files. |
|
Tested
|
This was referenced Nov 23, 2026
|
Tested
AI-assisted (Claude Code). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item: EGEN-XMEM-COMMIT-PLACEHOLDER (claimed in #8344: #8344 (comment))
XMemVirtualAllocbacks every reserve-only guest page-mode range with a Windows placeholder (#6919), and Windows refuses a commit inside a placeholder. The retail executable's own measured calls reserve a 64 KiB-page range and commit it later at the same address (docs/xmem_exe_calls.md:allocation_type0x20402000with attributes0x21, then0x20401000with attributes0x283, one site each). Onmainthat pair now fails: the reserve succeeds and the commit returns NULL withERROR_INVALID_ADDRESS(487). Before #6919 the reserve was a plainVirtualAllocreservation, so the commit worked.The fix splits the committed range out of its placeholder and replaces it with a committed allocation at the same address (
VirtualAlloc2withMEM_REPLACE_PLACEHOLDER | MEM_RESERVE), and cuts that range out of the physical-page window table, so a later page map cannot target committed memory. A commit that does not name a reserved window goes through the unchangedVirtualAllocpath.Tested
Windows 11, MSVC 14.44 (BuildTools 2022),
/MD /O2with the repository's/W4 /permissive-,upstream/mainb763516e8(before) and this branch (after). No GPU needed.A scratch driver calls the registered shim exactly as an import does,
rt::shims::find("xmem.dll", "XMemVirtualAlloc"), with the measured shapes (driver kept out of the repository):Before (
runtime/shims/xmem.cppatb763516e8):After:
The same driver also calls every measured
XMemVirtualAllocshape and the 185 MiBMEM_RESERVE_PLACEHOLDERcarve; all pass before and after.runtime/test/xmem_test.cpp, compiled againstruntime/shims/xmem.cpp+registry.cpp(the new checks):The rest of
xmem_testis unchanged and still covers the physical-page windows: a window stays reserve-only, pages map into it, and the remainder of a carved placeholder is still reserved.First stop that remains:
docs/retail_boot_chain.md's stop 13 (the descriptor heap handle right afterCreateDescriptorHeap), which is the D3D12 layer's, not imports. I could not run the retail executable here (no network-isolated run available, and the boot page asks for the network off); the command that would verify this pair at boot is the--runindocs/boot.mdwith--traceand--trace-d3d12, looking for anxmem_attributesevent for0x20401000and noint3in the allocator.No game data: the diff holds public SDK constants and the two call shapes already recorded in
docs/xmem_exe_calls.md;python -I scripts/check_no_game_data.pyon both files is clean.AI-assisted: yes.
Tag: SHAYDERRR