tests: make the xmem second-commit refusals reach the path they claim #1019
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1026"
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 rasptum on 2026-11-23T22:06:48Z.
Follow-up to #981, fixing the review from Leyukaka. Refs #981 #870
Which claims in #981 were tautological
XMemVirtualAlloc"second commit" refusals never reached a second commit. The desktopXMemVirtualAlloc(src/xmem_mapped_pages.cpp) refuses withERROR_INVALID_PARAMETERany non-null address, any size other than 16/24 GiB, any type other than0x20402000, and any attribute/protection pair other than0x21/PAGE_READWRITEor3/0x801, before it looks at memory. Both calls in #981 (nullptr, 64 KiB, MEM_RESERVE|MEM_COMMIT, 0x21, PAGE_READWRITEandview1, 64 KiB, MEM_COMMIT, 0x21, PAGE_READONLY) failed on those arguments. So "leaves both live views intact" was true by construction.first_observable_discrepancyline was fixed text apart from the decommit error code, and it printed even when a check had failed.The remap-over-live-view and free-while-mapped checks did exercise shim state. They are kept, and the docs now point out that the same calls succeed once the views are unmapped.
What changed
XMemVirtualAlloc second commit: recorded as not reachable through the current shim. Each case starts from the accepted #888 reserve-only call (null, 16 GiB,
0x20402000,0x21,PAGE_READWRITE), which must reserve address space in the same run, and changes one variable:MEM_COMMITadded to the type: refused87PAGE_READONLY: refused8787both timesSince the paired accepted call succeeds and the live and free targets are refused the same way, each refusal comes from argument validation, so none is reported as a second-commit result. The output line says
NOT REACHABLE through the current shim.Second private commit at another VA (placeholder replaced with
VirtualAlloc2(..., MEM_REPLACE_PLACEHOLDER)): zero-filled, does not show page 0's bytes, and writes through it do not reach page 0. The fixture does not try to map page 0 itself at a second VA, because Win32 aliases memory only through section objects and no call takes an existingMEM_PRIVATErange as a mapping source. The docs now say this as a statement about the API surface rather than as a measurement.first_observable_discrepancyis built from measured values: the private and mappedVirtualQuerytype, the private decommit result, second-VA independence, the mapped decommit error, alias visibility, per-view isolation and unmap/remap persistence. It prints only when every check behind those fields passed. Otherwise it printsnot printed; failing_fields=....Seven mutation controls (
xmem_commit_protection_mutate_*). Each one runs the same binary with--mutate <name>, which flips one expected value. A control passes only if the check that owns that expectation printscheck_failed: <check>and the run does not printPASS. The three that feed the discrepancy line also requirefailing_fields=<field>. An unknown mutation name fails.xva_positive_refusedxva_accepted_pairxva_commit_acceptedxva_commit_bitxva_readonly_acceptedxva_protectionxva_state_dependentxva_address_state_independentprivate_second_va_aliasesprivate_second_va_independent+failing_fields=private_second_vaprivate_type_mappedprivate_type+failing_fields=private_typemapped_decommit_succeedsmapped_decommit+failing_fields=mapped_decommitNo change to
src/. Only the fixture, its CMake registration and the docs section changed.Evidence
Environment: Windows 10 Pro 19045, MSVC VS2022 x64, no GPU involved.
Commands (dev and release presets):
cd879076(the main run plus 7 mutation controls are among the 33). No skips. All four Python checks passed.ee04692c, adding only unrelated CMakeLists lines (nosrc/or fixture changes). After rebasing onto it,-R xmem_commit_protection(main run plus 7 mutations) passed 8/8 in dev and 8/8 in release. The full filter was not rerun on this final base.Measured output (dev):
Still a hypothesis: whether a console caller needs a live shared-page view or ordinary committed pages at any given second-commit site. This fixture does not establish full-game startup.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T22:29:17Z.
I reproduced all eight xmem commit-protection CTests in local Windows Release. The /O2 job failed earlier in the independent
cpu_native_reloc_freefixture: its fixed preferred address was already occupied and the setup returned Win32 487. The xmem checks passed there. I am investigating the shared fixture separately. This PR is held until both Windows checks are green.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T22:54:26Z.
The shared preferred-address fixture fix #1040 is on main. The updated candidate
ee2d05ebpassed all nine targeted Windows Release tests (eight xmem controls and the native relocation fixture). Fresh CI is running on this head.