cpu: start the load-config /guard:cf fixtures with an explicit CFG policy #1360

Merged
Maxim-Root merged 2 commits from upstream-pr/1367 into main 2026-11-24 17:16:49 +00:00
Maxim-Root commented 2026-11-24 09:25:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Maxim-Root on 2026-11-24T09:25:47Z.


Change

cpu_native_load_config_callback failed on every run on a host where system CFG is off. The check asserts that Windows replaces both guard slots of a /guard:cf image. That holds only when CFG is enforced for the process. A child inherits the host's CFG setting, so with system CFG off the loader keeps the image's own slots. cfg_record then behaved like record (exit 0x55, no slot bits) and the check stopped before reaching the pe_map side. Hosted CI uses the Windows default (CFG on), which is why it stayed green.

This PR starts the two /guard:cf images (cfg_record, cfg_invalid) with an explicit per-process PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY instead of the host default:

  • CFG always on: the existing assertions run unchanged. Both slots are replaced (0x30055), and the invalid target ends before writing output (0xC0000409).
  • CFG always off (new negative control): cfg_record must equal record and cfg_invalid must equal invalid. This shows that the policy, and nothing else, changes the result.
  • After each launch, the child's effective EnableControlFlowGuard bit is read from its handle and must match the requested policy. A launcher that silently ignores the policy is reported by name and does not turn into a pass.

The non-CFG variants, the pe_map side and every existing expected value are unchanged. Only tests/cpu/load_config_callback_check.py changes. No system setting is read or modified.

Fixes #1366

Verification

At f2082414 (on top of 4b166b7d), dev preset (Debug), Windows 11 Pro 26300.9818 with system CFG off (Get-ProcessMitigation -System), MSVC 14.44.35207, Python 3.12.10:

ctest --preset dev --no-tests=error -R '^cpu_native_load_config_callback$' -V
cfg_record: Windows exit 0x30055 trace 0x2200000011 0x100000033 0x3008; pe_map exit 0x55 trace 0x2200000011 0x100000033 0x3008; mapped slots read-only and relocated; Windows with CFG off exit 0x55 trace 0x2200000011 0x100000033 0x3008 (same as record)
cfg_invalid: Windows exit 0xc0000409 trace none; pe_map exit 0x77 trace 0x0 0x0 0x0; unchecked target (current observation); mapped slots read-only and relocated; Windows with CFG off exit 0x77 trace 0x0 0x0 0x0 (same as invalid)
load-config dispatch callback: PASS (valid callback and layout asserted; pe_map CFG boundary recorded)

Before this change, the same command at c4966c64 failed with AssertionError: cfg_record: Windows (85, (...)), expected both slots replaced and 0x55.

  • ctest ... -R '^cpu_native_load_config_callback$' --repeat until-fail:10: 10/10 passed.
  • ctest --preset pr --no-tests=error -j 16 with X2W_REQUIRE_SPIRV_TOOLS=1: 24/24 passed.
  • ctest --preset dev --no-tests=error -E '_hardware$' -j 16 (same change on c4966c64, before the rebase): 587/589 passed. The two failures, cpu_native_worker_alive and cpu_native_package_ordinal_startup, are 30 s timeouts under -j 16 load. They also occur at c4966c64 without this change when this test is excluded, and both pass when run alone. I will report them separately.
  • Mutation checks (local copies, not committed):
    • with the two policy values swapped, the check fails with cfg_record: requested CFG on, but the child reports EnableControlFlowGuard=0;
    • with an invalid (zero) policy value, CreateProcessW fails with error 87 and the check fails.

Not run here: a host with system CFG on. The always-on branch gives the same result the hosted runner already measured. The always-off control on a CFG-on host is exercised by the Build and test on Windows job.

Evidence and follow-up

No new fixture binaries: the existing source-built cpu_load_callback_* images are used. Related: #1293 hits the opposite host condition (system CFG on) in the archive tests. A per-process policy like this one could give that check a deterministic positive and negative run as well.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed. (No capability or requirement changes.)
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6578659294 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1367). Originally posted by [Maxim-Root](https://github.com/Maxim-Root) on 2026-11-24T09:25:47Z. --- ## Change `cpu_native_load_config_callback` failed on every run on a host where system CFG is off. The check asserts that Windows replaces both guard slots of a `/guard:cf` image. That holds only when CFG is enforced for the process. A child inherits the host's CFG setting, so with system CFG off the loader keeps the image's own slots. `cfg_record` then behaved like `record` (exit `0x55`, no slot bits) and the check stopped before reaching the `pe_map` side. Hosted CI uses the Windows default (CFG on), which is why it stayed green. This PR starts the two `/guard:cf` images (`cfg_record`, `cfg_invalid`) with an explicit per-process `PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY` instead of the host default: - **CFG always on**: the existing assertions run unchanged. Both slots are replaced (`0x30055`), and the invalid target ends before writing output (`0xC0000409`). - **CFG always off** (new negative control): `cfg_record` must equal `record` and `cfg_invalid` must equal `invalid`. This shows that the policy, and nothing else, changes the result. - After each launch, the child's effective `EnableControlFlowGuard` bit is read from its handle and must match the requested policy. A launcher that silently ignores the policy is reported by name and does not turn into a pass. The non-CFG variants, the `pe_map` side and every existing expected value are unchanged. Only `tests/cpu/load_config_callback_check.py` changes. No system setting is read or modified. Fixes #1366 ## Verification At `f2082414` (on top of `4b166b7d`), `dev` preset (Debug), Windows 11 Pro 26300.9818 with system CFG **off** (`Get-ProcessMitigation -System`), MSVC 14.44.35207, Python 3.12.10: ```powershell ctest --preset dev --no-tests=error -R '^cpu_native_load_config_callback$' -V ``` ```text cfg_record: Windows exit 0x30055 trace 0x2200000011 0x100000033 0x3008; pe_map exit 0x55 trace 0x2200000011 0x100000033 0x3008; mapped slots read-only and relocated; Windows with CFG off exit 0x55 trace 0x2200000011 0x100000033 0x3008 (same as record) cfg_invalid: Windows exit 0xc0000409 trace none; pe_map exit 0x77 trace 0x0 0x0 0x0; unchecked target (current observation); mapped slots read-only and relocated; Windows with CFG off exit 0x77 trace 0x0 0x0 0x0 (same as invalid) load-config dispatch callback: PASS (valid callback and layout asserted; pe_map CFG boundary recorded) ``` Before this change, the same command at `c4966c64` failed with `AssertionError: cfg_record: Windows (85, (...)), expected both slots replaced and 0x55`. - `ctest ... -R '^cpu_native_load_config_callback$' --repeat until-fail:10`: 10/10 passed. - `ctest --preset pr --no-tests=error -j 16` with `X2W_REQUIRE_SPIRV_TOOLS=1`: 24/24 passed. - `ctest --preset dev --no-tests=error -E '_hardware$' -j 16` (same change on `c4966c64`, before the rebase): 587/589 passed. The two failures, `cpu_native_worker_alive` and `cpu_native_package_ordinal_startup`, are 30 s timeouts under `-j 16` load. They also occur at `c4966c64` without this change when this test is excluded, and both pass when run alone. I will report them separately. - **Mutation checks** (local copies, not committed): - with the two policy values swapped, the check fails with `cfg_record: requested CFG on, but the child reports EnableControlFlowGuard=0`; - with an invalid (zero) policy value, `CreateProcessW` fails with error 87 and the check fails. Not run here: a host with system CFG **on**. The always-on branch gives the same result the hosted runner already measured. The always-off control on a CFG-on host is exercised by the `Build and test on Windows` job. ## Evidence and follow-up No new fixture binaries: the existing source-built `cpu_load_callback_*` images are used. Related: #1293 hits the opposite host condition (system CFG on) in the archive tests. A per-process policy like this one could give that check a deterministic positive and negative run as well. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. (No capability or requirement changes.) - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tedin7 commented 2026-11-24 10:02:32 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T09:42:18Z.

Review: COMMENTED


Technical peer-review of commit f2082414689a5d9413fa912899d5f71bc212cf53:

Verification

  • Linux:
    • git diff --check origin/main...HEAD: clean.
    • tests/docs_links_check.py: passed (16 Markdown files, 302 links).
    • tests/bidi_controls_check.py: passed (1,146 files).
    • python -B -m py_compile tests/cpu/load_config_callback_check.py: passed.
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207):
    • Debug (--preset dev): targets built (0.08s); ctest -R '^cpu_native_load_config_callback$' 1/1 passed (1.16s).
    • Release /O2 (--preset release): targets built (2.68s); ctest -R '^cpu_native_load_config_callback$' 1/1 passed (1.05s).

Findings (tests/cpu/load_config_callback_check.py)

  • No defects found.
  • PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY (0x20007), PROCESS_CREATION_MITIGATION_POLICY_CONTROL_FLOW_GUARD_ALWAYS_ON (1 << 40) / _ALWAYS_OFF (2 << 40), StartupInfoEx x64 layout, GetProcessMitigationPolicy(..., ProcessControlFlowGuardPolicy=7, ...) bit-0 verification, handle/attribute-list cleanup, and the CFG-off negative control (uncontrolled == expected[base]) are all sound.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6036883617 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1367#pullrequestreview-6036883617). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T09:42:18Z. **Review:** COMMENTED --- Technical peer-review of commit `f2082414689a5d9413fa912899d5f71bc212cf53`: ### Verification - **Linux**: - `git diff --check origin/main...HEAD`: clean. - `tests/docs_links_check.py`: passed (16 Markdown files, 302 links). - `tests/bidi_controls_check.py`: passed (1,146 files). - `python -B -m py_compile tests/cpu/load_config_callback_check.py`: passed. - **Windows Server 2025 (Build 26100, MSVC 14.44.35207)**: - **Debug (`--preset dev`)**: targets built (`0.08s`); `ctest -R '^cpu_native_load_config_callback$'` **1/1 passed** (`1.16s`). - **Release `/O2` (`--preset release`)**: targets built (`2.68s`); `ctest -R '^cpu_native_load_config_callback$'` **1/1 passed** (`1.05s`). ### Findings (`tests/cpu/load_config_callback_check.py`) - No defects found. - `PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY` (`0x20007`), `PROCESS_CREATION_MITIGATION_POLICY_CONTROL_FLOW_GUARD_ALWAYS_ON` (`1 << 40`) / `_ALWAYS_OFF` (`2 << 40`), `StartupInfoEx` x64 layout, `GetProcessMitigationPolicy(..., ProcessControlFlowGuardPolicy=7, ...)` bit-0 verification, handle/attribute-list cleanup, and the CFG-off negative control (`uncontrolled == expected[base]`) are all sound.
JohnConnorNPC commented 2026-11-24 10:02:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-24T09:38:52Z.


Read through f2082414. The launcher looks correct to me and no existing assertion is weakened. One gap in the evidence, then some small things. I could not run it (no Windows host here), so this is from the code and the workflow only.

The CFG-on host path has not run in CI. The description says the always-off control on a CFG-on host "is exercised by the Build and test on Windows job". On a pull request that job runs ctest --preset pr (.github/workflows/windows.yml), and the pr preset's include filter in CMakePresets.json does not match cpu_native_load_config_callback. So the green check on this PR did not execute the changed test, and the only measurement is the CFG-off host in the description. Two things are therefore unmeasured on a CFG-on host:

  • that ALWAYS_OFF overrides a system-on default for these images (the control), and
  • that GetProcessMitigationPolicy succeeds on the handle of a process that has already exited on the hosted image. It worked on build 26300; the documentation only states the access right.

If either differs, the first run to show it would be the dev preset on main after the merge. A workflow_dispatch run of the workflow on this branch, or a local run on a host with system CFG on, would close it.

Smaller points, none blocking:

  • CreateProcessW is called with bInheritHandles=True and no PROC_THREAD_ATTRIBUTE_HANDLE_LIST, so the child inherits every inheritable handle of the test process, not only the three opened for it. The attribute list would need a count of 2.
  • Four launches at 30 s each add up to the test's 120 s ctest TIMEOUT, so with a hung child ctest can end the test before its own "did not end" message prints. The shared launch() also records thread state on a timeout, which this path skips.
  • When one of the three CreateFileW calls fails, the error is read after all three, so a later successful call can replace it; the raised WinError may then name the wrong cause.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7127697286 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1367#issuecomment-7127697286). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-11-24T09:38:52Z. --- Read through `f2082414`. The launcher looks correct to me and no existing assertion is weakened. One gap in the evidence, then some small things. I could not run it (no Windows host here), so this is from the code and the workflow only. **The CFG-on host path has not run in CI.** The description says the always-off control on a CFG-on host "is exercised by the `Build and test on Windows` job". On a pull request that job runs `ctest --preset pr` (`.github/workflows/windows.yml`), and the `pr` preset's include filter in `CMakePresets.json` does not match `cpu_native_load_config_callback`. So the green check on this PR did not execute the changed test, and the only measurement is the CFG-off host in the description. Two things are therefore unmeasured on a CFG-on host: - that `ALWAYS_OFF` overrides a system-on default for these images (the control), and - that `GetProcessMitigationPolicy` succeeds on the handle of a process that has already exited on the hosted image. It worked on build 26300; the documentation only states the access right. If either differs, the first run to show it would be the `dev` preset on `main` after the merge. A `workflow_dispatch` run of the workflow on this branch, or a local run on a host with system CFG on, would close it. **Smaller points, none blocking:** - `CreateProcessW` is called with `bInheritHandles=True` and no `PROC_THREAD_ATTRIBUTE_HANDLE_LIST`, so the child inherits every inheritable handle of the test process, not only the three opened for it. The attribute list would need a count of 2. - Four launches at 30 s each add up to the test's 120 s ctest `TIMEOUT`, so with a hung child ctest can end the test before its own "did not end" message prints. The shared `launch()` also records thread state on a timeout, which this path skips. - When one of the three `CreateFileW` calls fails, the error is read after all three, so a later successful call can replace it; the raised `WinError` may then name the wrong cause.
tedin7 commented 2026-11-24 11:02:38 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T10:03:58Z.

Review: COMMENTED


Technical peer-review (retest) of commit 818181369f3e59f8ab1d7fd2a1453dec0f604e1a:

Verification

  • Linux:
    • git diff --check origin/main...HEAD: clean.
    • tests/docs_links_check.py: passed (16 Markdown files, 302 links).
    • tests/bidi_controls_check.py: passed (1,146 files).
    • python -B -m py_compile tests/cpu/load_config_callback_check.py: passed.
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev): targets built (0.08s, configure 1.72s); ctest -R '^cpu_native_load_config_callback$' 1/1 passed (1.02s).
    • Release /O2 (--preset release): targets built (0.08s, configure 1.59s); ctest -R '^cpu_native_load_config_callback$' 1/1 passed (0.96s).

Findings (tests/cpu/load_config_callback_check.py)

  • Delta commit 81818136 cleanly addresses the handle-inheritance and error-capture follow-ups:
    • PROC_THREAD_ATTRIBUTE_HANDLE_LIST (0x20002) restricts inherited handles to stdin/stdout/stderr.
    • CreateFileW errors are captured immediately before closing previously opened handles.
    • timeout=15 keeps all four policy launches well within the 120s CTest timeout and records thread_ids(process.pid) before terminating on a hang.
  • No defects found.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6037202395 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1367#pullrequestreview-6037202395). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T10:03:58Z. **Review:** COMMENTED --- Technical peer-review (retest) of commit `818181369f3e59f8ab1d7fd2a1453dec0f604e1a`: ### Verification - **Linux**: - `git diff --check origin/main...HEAD`: clean. - `tests/docs_links_check.py`: passed (16 Markdown files, 302 links). - `tests/bidi_controls_check.py`: passed (1,146 files). - `python -B -m py_compile tests/cpu/load_config_callback_check.py`: passed. - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - **Debug (`--preset dev`)**: targets built (`0.08s`, configure `1.72s`); `ctest -R '^cpu_native_load_config_callback$'` **1/1 passed** (`1.02s`). - **Release `/O2` (`--preset release`)**: targets built (`0.08s`, configure `1.59s`); `ctest -R '^cpu_native_load_config_callback$'` **1/1 passed** (`0.96s`). ### Findings (`tests/cpu/load_config_callback_check.py`) - Delta commit `81818136` cleanly addresses the handle-inheritance and error-capture follow-ups: - `PROC_THREAD_ATTRIBUTE_HANDLE_LIST` (`0x20002`) restricts inherited handles to `stdin`/`stdout`/`stderr`. - `CreateFileW` errors are captured immediately before closing previously opened handles. - `timeout=15` keeps all four policy launches well within the 120s CTest timeout and records `thread_ids(process.pid)` before terminating on a hang. - No defects found.
Maxim-Root commented 2026-11-24 11:02:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Maxim-Root on 2026-11-24T10:22:47Z.


@JohnConnorNPC thanks, you were right about the CI claim. The pr preset does not include cpu_native_load_config_callback, so the green check never ran it. I have corrected that point below and measured both unmeasured items on a host where CFG is on by default.

CFG-on host run. I could not get a full workflow_dispatch run of windows.yml in my fork to finish: both the Debug and /O2 jobs hit the 20-minute timeout-minutes (the fork-runner limit also mentioned in #1173). Instead I ran a fork-only probe workflow on the hosted windows-2025 image. It records the runner's system CFG setting, builds only the load-config targets at this PR's head 81818136, and runs the test three times. The probe is not part of this PR: run 45373932340, workflow file.

Microsoft Windows NT 10.0.26100.0   (Windows Server 2025)
Get-ProcessMitigation -System -> CFG Enable: NOTSET   (the Windows default, which is on)

ctest --preset dev --no-tests=error -R '^cpu_native_load_config_callback$' -V --repeat until-fail:3
cfg_record: Windows exit 0x30055 ...; pe_map exit 0x55 ...; Windows with CFG off exit 0x55 trace 0x2200000011 0x100000033 0x3008 (same as record)
cfg_invalid: Windows exit 0xc0000409 trace none; pe_map exit 0x77 ...; Windows with CFG off exit 0x77 trace 0x0 0x0 0x0 (same as invalid)
load-config dispatch callback: PASS   (3/3 runs)

This covers both points:

  • ALWAYS_OFF overrides a system-on default for these images. The CFG-off control gives 0x55 and 0x77 on the hosted image, exactly as on my CFG-off host.
  • GetProcessMitigationPolicy on an exited child's handle succeeds on build 26100. Otherwise launch_cfg would have raised before the comparison. It also works on 26300.

Together with my CFG-off host (26300) and @tedin7's Windows Server 2025 runs, the check has now passed on both host settings in Debug, and in /O2 on 26100.

The three smaller points are addressed in 81818136, which @tedin7 re-reviewed:

  • The child now inherits only stdin, stdout and stderr, through PROC_THREAD_ATTRIBUTE_HANDLE_LIST with an attribute count of 2.
  • launch_cfg waits 15 s per launch, so the four launches take at most 60 s within the 120 s CTest timeout. A launch that does not end records thread_ids(pid) before it is terminated. I checked this path locally against a deliberately lingering EXE: signaled=False, one live thread recorded, terminated after 1.0 s.
  • The CreateFileW error is read immediately after the failing call and names the file.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7128696769 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1367#issuecomment-7128696769). Originally posted by [Maxim-Root](https://github.com/Maxim-Root) on 2026-11-24T10:22:47Z. --- @JohnConnorNPC thanks, you were right about the CI claim. The `pr` preset does not include `cpu_native_load_config_callback`, so the green check never ran it. I have corrected that point below and measured both unmeasured items on a host where CFG is on by default. **CFG-on host run.** I could not get a full `workflow_dispatch` run of `windows.yml` in my fork to finish: both the Debug and `/O2` jobs hit the 20-minute `timeout-minutes` (the fork-runner limit also mentioned in #1173). Instead I ran a fork-only probe workflow on the hosted `windows-2025` image. It records the runner's system CFG setting, builds only the load-config targets at this PR's head `81818136`, and runs the test three times. The probe is not part of this PR: [run 45373932340](https://github.com/Maxim-Root/Xbox2Windows/actions/runs/45373932340), [workflow file](https://github.com/Maxim-Root/Xbox2Windows/blob/ci/cfg-on-probe/.github/workflows/cfg-probe.yml). ```text Microsoft Windows NT 10.0.26100.0 (Windows Server 2025) Get-ProcessMitigation -System -> CFG Enable: NOTSET (the Windows default, which is on) ctest --preset dev --no-tests=error -R '^cpu_native_load_config_callback$' -V --repeat until-fail:3 cfg_record: Windows exit 0x30055 ...; pe_map exit 0x55 ...; Windows with CFG off exit 0x55 trace 0x2200000011 0x100000033 0x3008 (same as record) cfg_invalid: Windows exit 0xc0000409 trace none; pe_map exit 0x77 ...; Windows with CFG off exit 0x77 trace 0x0 0x0 0x0 (same as invalid) load-config dispatch callback: PASS (3/3 runs) ``` This covers both points: - **`ALWAYS_OFF` overrides a system-on default** for these images. The CFG-off control gives `0x55` and `0x77` on the hosted image, exactly as on my CFG-off host. - **`GetProcessMitigationPolicy` on an exited child's handle** succeeds on build 26100. Otherwise `launch_cfg` would have raised before the comparison. It also works on 26300. Together with my CFG-off host (26300) and @tedin7's Windows Server 2025 runs, the check has now passed on both host settings in Debug, and in `/O2` on 26100. **The three smaller points** are addressed in `81818136`, which @tedin7 re-reviewed: - The child now inherits only stdin, stdout and stderr, through `PROC_THREAD_ATTRIBUTE_HANDLE_LIST` with an attribute count of 2. - `launch_cfg` waits 15 s per launch, so the four launches take at most 60 s within the 120 s CTest timeout. A launch that does not end records `thread_ids(pid)` before it is terminated. I checked this path locally against a deliberately lingering EXE: `signaled=False`, one live thread recorded, terminated after 1.0 s. - The `CreateFileW` error is read immediately after the failing call and names the file. AI-assisted (Claude Code).
upstream-sync closed this pull request 2026-11-24 18:02:08 +00:00
tedin7 commented 2026-11-24 18:02:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:16:28Z.

Review: COMMENTED


Verification review for commit 818181369f3e59f8ab1d7fd2a1453dec0f604e1a:

Scope & Audit

  • Tests-only diff (tests/cpu/load_config_callback_check.py, +138/-10): launches /guard:cf fixtures with explicit PROCESS_CREATION_MITIGATION_POLICY_CONTROL_FLOW_GUARD_ALWAYS_ON (1 << 40) and _ALWAYS_OFF (2 << 40) via PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY (0x20007), restricts handle inheritance via PROC_THREAD_ATTRIBUTE_HANDLE_LIST (0x20002), verifies each child's effective EnableControlFlowGuard bit via GetProcessMitigationPolicy(..., 7, ...), and asserts the CFG-off negative control matches the non-/guard:cf baseline.
  • Zero production code changes, zero weakened assertions, proper handle/attribute-list/process cleanup, all temp files inside TemporaryDirectory, clean-room/title-neutral.

Checks Executed

  • Linux:
    • git diff --check origin/main...HEAD: clean.
    • python3 -I tests/docs_links_check.py: passed (16 Markdown files, 302 links).
    • python3 -I tests/bidi_controls_check.py: passed (1,146 files, no bidirectional controls).
    • python3 -B -m py_compile tests/cpu/load_config_callback_check.py: passed.
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev): targets built (0.08s, configure 1.72s); ctest --preset dev -R '^cpu_native_load_config_callback$' --no-tests=error: 1/1 passed (1.02s).
    • Release /O2 (--preset release): targets built (0.08s, configure 1.59s); ctest --preset release -R '^cpu_native_load_config_callback$' --no-tests=error: 1/1 passed (0.96s).
  • Mutation checks (Win2025 Debug via --patch, cache bypassed, repo restored after each run):
    1. Swapped CFG_POLICY "on" / "off" (2 << 40 / 1 << 40): cpu_native_load_config_callback failed (AssertionError: cfg_record: requested CFG on, but the child reports EnableControlFlowGuard=0).
    2. Set CFG_POLICY["off"] = 0 (defer to host default): cpu_native_load_config_callback failed (AssertionError: cfg_record: requested CFG off, but the child reports EnableControlFlowGuard=1), confirming ALWAYS_OFF overrides the CFG-on host default.

Verdict: 0 P1, 0 P2. Clean Tier B merge candidate.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6044001328 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1367#pullrequestreview-6044001328). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T17:16:28Z. **Review:** COMMENTED --- Verification review for commit `818181369f3e59f8ab1d7fd2a1453dec0f604e1a`: ### Scope & Audit - Tests-only diff (`tests/cpu/load_config_callback_check.py`, +138/-10): launches `/guard:cf` fixtures with explicit `PROCESS_CREATION_MITIGATION_POLICY_CONTROL_FLOW_GUARD_ALWAYS_ON` (`1 << 40`) and `_ALWAYS_OFF` (`2 << 40`) via `PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY` (`0x20007`), restricts handle inheritance via `PROC_THREAD_ATTRIBUTE_HANDLE_LIST` (`0x20002`), verifies each child's effective `EnableControlFlowGuard` bit via `GetProcessMitigationPolicy(..., 7, ...)`, and asserts the CFG-off negative control matches the non-`/guard:cf` baseline. - Zero production code changes, zero weakened assertions, proper handle/attribute-list/process cleanup, all temp files inside `TemporaryDirectory`, clean-room/title-neutral. ### Checks Executed - **Linux**: - `git diff --check origin/main...HEAD`: clean. - `python3 -I tests/docs_links_check.py`: passed (16 Markdown files, 302 links). - `python3 -I tests/bidi_controls_check.py`: passed (1,146 files, no bidirectional controls). - `python3 -B -m py_compile tests/cpu/load_config_callback_check.py`: passed. - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - **Debug (`--preset dev`)**: targets built (`0.08s`, configure `1.72s`); `ctest --preset dev -R '^cpu_native_load_config_callback$' --no-tests=error`: **1/1 passed** (`1.02s`). - **Release `/O2` (`--preset release`)**: targets built (`0.08s`, configure `1.59s`); `ctest --preset release -R '^cpu_native_load_config_callback$' --no-tests=error`: **1/1 passed** (`0.96s`). - **Mutation checks (Win2025 Debug via `--patch`, cache bypassed, repo restored after each run)**: 1. Swapped `CFG_POLICY` `"on"` / `"off"` (`2 << 40` / `1 << 40`): `cpu_native_load_config_callback` **failed** (`AssertionError: cfg_record: requested CFG on, but the child reports EnableControlFlowGuard=0`). 2. Set `CFG_POLICY["off"] = 0` (defer to host default): `cpu_native_load_config_callback` **failed** (`AssertionError: cfg_record: requested CFG off, but the child reports EnableControlFlowGuard=1`), confirming `ALWAYS_OFF` overrides the CFG-on host default. Verdict: 0 P1, 0 P2. Clean Tier B merge candidate. AI-assisted; commands listed were executed locally.
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!1360
No description provided.