runtime: check the XMemVirtualQuery tail flag when it is clear #1532
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1539"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-24T13:46:52Z.
Change
era_query(src/era_query.{h,cpp}) answersXMemVirtualQuerywith the desktopVirtualQueryExresult plus a tail byte at +0x30. The byte is 0x01 when the address lies in a registered GPU region of the current process, and 0x00 otherwise. The header anddocs/experiments.mdmake two promises about it:Every existing check (
era_query_{fields,tail,registry,short},era_title_gpu_alloc,xmem_shim_query) queries this process into a zeroed buffer, so neither promise is tested. Three mutants left all of them passing:GetProcessId(process) != 0instead of== GetCurrentProcessId().XMemVirtualQuerypasses the caller's process handle and buffer straight through, so both rules are reachable from real callers.The new
era_query_clearscenario fills the 64-byte buffer with 0xff before each query. Its expected values are hand-written:MEM_COMMIT,PAGE_READWRITEand tail 0x00, so the callers' tail check rejects it.The child never runs. It is terminated and waited for, and its handles are closed on every path. The memory is released and the region unregistered.
era_query_clear_foreign_control(clear --mutate foreign) expects 0x01 for the child and must fail (WILL_FAIL).The change touches
tests/era_query_check.cpp(theclearscenario), twoadd_testlines after theera_query_*foreach inCMakeLists.txt, and a newera_query_clearrow in thedocs/experiments.mdera_query table.Verification
Commit
309cfede(main) plus this change,devpreset (Debug), Windows 11 Pro build 26300.9974, MSVC 19.51.36260, Windows SDK 10.0.26100.0.tests/docs_links_check.py,tests/bidi_controls_check.pyandgit diff --checkpassed.Mutation probe
I applied each mutation to
src/era_query.{h,cpp}alone, rebuilt, ran the tests, then reverted. None of this is committed.era_query_clearGetProcessId(process) != 0>=)VirtualQueryExfailure ignoredxmem_shim_query)Checklist
AI-assisted (Claude Code).