runtime: accept the 0x283/0x2004 pool block in the startup commit profile #1257

Merged
rasptum merged 1 commit from upstream-pr/1264 into main 2026-11-24 06:33:37 +00:00
rasptum commented 2026-11-24 06:12:46 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-24T06:12:46Z.


Refs #870. Follows #1098.

Problem

After its four large blocks, the pool loop observed on #870 makes two more XMemVirtualAlloc calls:

base type attribute protection size
null 0x20003000 0x283 0x2004 0x1e00000
null 0x20003000 0x283 0x2004 0x2000000

The startup commit profile from #1098 accepts attribute 0x283 only with protection 0x2404, so both calls return NULL with ERROR_INVALID_PARAMETER (87). A startup run on main then stops at about 220 s on a null resource lookup in the caller (access violation reading address 8). Accepting the pair is the only change that removes that stop: with the previous xmem_mapped_pages.cpp restored, or with this pair added, the run continues through the setup pages.

Change

This is a proposed desktop policy, like the other pairs (no independent reference describes these attribute words). 0x283/0x2004 becomes a fourth accepted configuration of the MEM_LARGE_PAGES type 0x20003000, with the same rules as the others:

  • the base is 2 MiB-aligned;
  • the size must be a nonzero multiple of 64 KiB;
  • exactly the requested size is committed, zero-filled, as PAGE_READWRITE.

As with the second pair, the console bit 0x2000 above PAGE_READWRITE is not reproduced. Every other argument set keeps the refusal. There's no permissive fallback.

Test

cpu_native_xmem_pool_commit (tests/cpu/xmem_pool_commit.asm + _check.py):

  • New block D with this pair and a size of 2 MiB + 128 KiB, so rounding the reservation up to 2 MiB would fail the region-size and next-allocation checks. It gets the same alignment, VirtualQuery, zero-fill and pattern checks as A, B and C, and the same release check.
  • New refusal: the pair with the 64 KiB-page type 0x20403000.
  • Kept: protection 0x2004 with attribute 0x183 stays refused, as before. All existing controls are kept.
  • The later steps move by four, and so do the controls' expected codes: accepted_refusal 0xF13, host_fit 0xF1C, skip_release 0xF1E. reserve_only, misaligned and dirty are unchanged.
  • Mutant (local, not committed): with main's xmem_mapped_pages.cpp, the original EXE exits 0xF0D (step 13, block D refused) under both the Windows loader and pe_map.
ctest --preset dev --no-tests=error -R '^(cpu_native_xmem_pool_commit|xmem_commit_protection)$' -V
ctest --preset release --no-tests=error -R '^(cpu_native_xmem_pool_commit|xmem_commit_protection)$' -V

Result on both presets: 2/2 passed. Every variant reports the same code under the Windows loader and pe_map (0x870, 0xf02, 0xf02, 0xf03, 0xf13, 0xf1c, 0xf1e), and a provider without XMemVirtualAlloc stops pe_map at that import. Re-run after rebasing onto f1b16abd.

Environment: Windows 10 Pro 19045, MSVC (VS 2022) x64, dev and release presets. No GPU is involved. Docs: docs/experiments.md "Reserve and commit startup blocks".

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6575844358 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1264). Originally posted by [rasptum](https://github.com/rasptum) on 2026-11-24T06:12:46Z. --- Refs #870. Follows #1098. ## Problem After its four large blocks, the pool loop observed on #870 makes two more `XMemVirtualAlloc` calls: | base | type | attribute | protection | size | |---|---|---|---|---| | null | `0x20003000` | `0x283` | `0x2004` | `0x1e00000` | | null | `0x20003000` | `0x283` | `0x2004` | `0x2000000` | The startup commit profile from #1098 accepts attribute `0x283` only with protection `0x2404`, so both calls return NULL with `ERROR_INVALID_PARAMETER` (87). A startup run on `main` then stops at about 220 s on a null resource lookup in the caller (access violation reading address 8). Accepting the pair is the only change that removes that stop: with the previous `xmem_mapped_pages.cpp` restored, or with this pair added, the run continues through the setup pages. ## Change This is a proposed desktop policy, like the other pairs (no independent reference describes these attribute words). `0x283`/`0x2004` becomes a fourth accepted configuration of the `MEM_LARGE_PAGES` type `0x20003000`, with the same rules as the others: - the base is 2 MiB-aligned; - the size must be a nonzero multiple of 64 KiB; - exactly the requested size is committed, zero-filled, as `PAGE_READWRITE`. As with the second pair, the console bit `0x2000` above `PAGE_READWRITE` is not reproduced. Every other argument set keeps the refusal. There's no permissive fallback. ## Test `cpu_native_xmem_pool_commit` (`tests/cpu/xmem_pool_commit.asm` + `_check.py`): - **New block D** with this pair and a size of 2 MiB + 128 KiB, so rounding the reservation up to 2 MiB would fail the region-size and next-allocation checks. It gets the same alignment, `VirtualQuery`, zero-fill and pattern checks as A, B and C, and the same release check. - **New refusal:** the pair with the 64 KiB-page type `0x20403000`. - **Kept:** protection `0x2004` with attribute `0x183` stays refused, as before. All existing controls are kept. - The later steps move by four, and so do the controls' expected codes: `accepted_refusal` `0xF13`, `host_fit` `0xF1C`, `skip_release` `0xF1E`. `reserve_only`, `misaligned` and `dirty` are unchanged. - **Mutant (local, not committed):** with `main`'s `xmem_mapped_pages.cpp`, the original EXE exits `0xF0D` (step 13, block D refused) under both the Windows loader and `pe_map`. ```powershell ctest --preset dev --no-tests=error -R '^(cpu_native_xmem_pool_commit|xmem_commit_protection)$' -V ctest --preset release --no-tests=error -R '^(cpu_native_xmem_pool_commit|xmem_commit_protection)$' -V ``` Result on both presets: 2/2 passed. Every variant reports the same code under the Windows loader and `pe_map` (`0x870`, `0xf02`, `0xf02`, `0xf03`, `0xf13`, `0xf1c`, `0xf1e`), and a provider without `XMemVirtualAlloc` stops `pe_map` at that import. Re-run after rebasing onto `f1b16abd`. Environment: Windows 10 Pro 19045, MSVC (VS 2022) x64, `dev` and `release` presets. No GPU is involved. Docs: `docs/experiments.md` "Reserve and commit startup blocks". AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 06:47:25 +00:00
tedin7 commented 2026-11-24 06:47:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T06:19:44Z.

Review: COMMENTED


Reviewed at commit bb206279d80ed5279e9dffe63dd6c98a06e910a6.

Verification

Linux

  • git diff --check origin/main...HEAD — clean
  • tests/docs_links_check.py — passed (16 Markdown files, 284 links)
  • tests/bidi_controls_check.py — passed (1065 tracked files)

Windows Server 2025 (Build 26100, MSVC 14.44.35207)

  • Debug (--preset dev):
    • Build (xmem_commit_protection_check, cpu_xmem_pool_*, xmem_shim, and downstream targets) — built cleanly (26.97s)
    • ctest --preset dev -R '^(cpu_native_xmem_pool_commit|xmem_commit_protection)$' --parallel 4 --no-tests=error --output-on-failure — 2/2 passed (xmem_commit_protection 0.02s, cpu_native_xmem_pool_commit 1.38s; total 1.43s)
  • Release /O2 (--preset release):
    • Build — built cleanly (43.59s)
    • ctest --preset release -R '^(cpu_native_xmem_pool_commit|xmem_commit_protection)$' --parallel 4 --no-tests=error --output-on-failure — 2/2 passed (xmem_commit_protection 0.02s, cpu_native_xmem_pool_commit 1.41s; total 1.47s)

Code Review Notes

  • src/xmem_mapped_pages.cpp: Narrowly extends commit_startup_block for allocation_type == 0x20003000 (large_pages) to accept attributes == 0x283 && protection == 0x2004 alongside 0x2404, preserving 2 MiB base alignment, nonzero 64 KiB multiple sizing, exact commit without rounding, and PAGE_READWRITE protection.
  • tests/cpu/xmem_pool_commit.asm + tests/cpu/xmem_pool_commit_check.py: Adds block D (SIZE_D = 0x220000, 2 MiB + 128 KiB) to verify non-rounded exact commit and adds the negative control refusing 0x283/0x2004 on PAGES_64K_TYPE (0x20403000), with updated step codes (0xF13, 0xF1C, 0xF1E).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6034590265 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1264#pullrequestreview-6034590265). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T06:19:44Z. **Review:** COMMENTED --- Reviewed at commit `bb206279d80ed5279e9dffe63dd6c98a06e910a6`. ### Verification **Linux** - `git diff --check origin/main...HEAD` — clean - `tests/docs_links_check.py` — passed (16 Markdown files, 284 links) - `tests/bidi_controls_check.py` — passed (1065 tracked files) **Windows Server 2025 (Build 26100, MSVC 14.44.35207)** - **Debug (`--preset dev`)**: - Build (`xmem_commit_protection_check`, `cpu_xmem_pool_*`, `xmem_shim`, and downstream targets) — built cleanly (`26.97s`) - `ctest --preset dev -R '^(cpu_native_xmem_pool_commit|xmem_commit_protection)$' --parallel 4 --no-tests=error --output-on-failure` — **2/2 passed** (`xmem_commit_protection` `0.02s`, `cpu_native_xmem_pool_commit` `1.38s`; total `1.43s`) - **Release `/O2` (`--preset release`)**: - Build — built cleanly (`43.59s`) - `ctest --preset release -R '^(cpu_native_xmem_pool_commit|xmem_commit_protection)$' --parallel 4 --no-tests=error --output-on-failure` — **2/2 passed** (`xmem_commit_protection` `0.02s`, `cpu_native_xmem_pool_commit` `1.41s`; total `1.47s`) ### Code Review Notes - `src/xmem_mapped_pages.cpp`: Narrowly extends `commit_startup_block` for `allocation_type == 0x20003000` (`large_pages`) to accept `attributes == 0x283 && protection == 0x2004` alongside `0x2404`, preserving 2 MiB base alignment, nonzero 64 KiB multiple sizing, exact commit without rounding, and `PAGE_READWRITE` protection. - `tests/cpu/xmem_pool_commit.asm` + `tests/cpu/xmem_pool_commit_check.py`: Adds block D (`SIZE_D = 0x220000`, 2 MiB + 128 KiB) to verify non-rounded exact commit and adds the negative control refusing `0x283`/`0x2004` on `PAGES_64K_TYPE` (`0x20403000`), with updated step codes (`0xF13`, `0xF1C`, `0xF1E`).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1257
No description provided.