cpu_aot_xsave_state: native XRSTOR accepts XCOMP_BV bit 3 on an MPX host (XCR0=0x1f) #1640

Closed
opened 2026-11-24 15:47:31 +00:00 by legacy-code-archaeologist · 3 comments
legacy-code-archaeologist commented 2026-11-24 15:47:31 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-24T15:47:31Z.


Commit or build

e3193607…7c5dac78 (main, after #1401), dev preset.

Reproduction

ctest --preset dev --no-tests=error -R '^cpu_aot_xsave_state$' --output-on-failure

Expected

The test passes, or reports a capability skip, on a host whose XCR0 enables more components than the fixture assumes.

Observed

AssertionError: native op_xrstor64_compacted_dynmask xcomp-bit3 accepted a header the instruction rejects

tests/cpu/xsave_state_check.py lists ("xcomp-bit3", 0, COMPACTED_BIT | 7 | 8, 7, ()) (and xcomp-bit4, xcomp-bit3-only) as headers that must raise #GP. Compacted XRSTOR raises #GP for an XCOMP_BV bit that is not enabled in XCR0. On this host XCR0 enables bits 3 and 4:

XCR0=0x1f  (x87, SSE, AVX, MPX BNDREGS, MPX BNDCSR)   CPUID.(EAX=0DH,ECX=1).EAX: XSAVEC=1 XSAVES=1   CPUID.7.EBX[14] MPX=1

So the native XRSTOR is right to accept bit 3, and the expectation only holds on hosts without MPX state in XCR0, such as Zen2, the target. The failure is on the native side, before the translation is compared.

Environment

Windows 11 Pro 26100.9168, Intel Core i7-6820HQ (Skylake, MPX), MSVC 19.52. Measured with _xgetbv(0) and __cpuidex in a small source-built probe.

Possible directions (for the fixture owner)

  • Derive the invalid XCOMP_BV bits from the host's XCR0, for example the lowest bits above 2 that XCR0 does not enable, rather than fixing bits 3 and 4.
  • Or skip the native comparison of exactly those cases (77, named) when XCR0 has them, and keep the translated refusal.

I haven't changed anything here. I'm happy to rerun on this host.

This report was prepared with AI assistance.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6585716003 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1647). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-24T15:47:31Z. --- ### Commit or build e3193607…7c5dac78 (main, after #1401), `dev` preset. ### Reproduction ``` ctest --preset dev --no-tests=error -R '^cpu_aot_xsave_state$' --output-on-failure ``` ### Expected The test passes, or reports a capability skip, on a host whose XCR0 enables more components than the fixture assumes. ### Observed ``` AssertionError: native op_xrstor64_compacted_dynmask xcomp-bit3 accepted a header the instruction rejects ``` `tests/cpu/xsave_state_check.py` lists `("xcomp-bit3", 0, COMPACTED_BIT | 7 | 8, 7, ())` (and `xcomp-bit4`, `xcomp-bit3-only`) as headers that must raise #GP. Compacted XRSTOR raises #GP for an XCOMP_BV bit that is *not enabled in XCR0*. On this host XCR0 enables bits 3 and 4: ``` XCR0=0x1f (x87, SSE, AVX, MPX BNDREGS, MPX BNDCSR) CPUID.(EAX=0DH,ECX=1).EAX: XSAVEC=1 XSAVES=1 CPUID.7.EBX[14] MPX=1 ``` So the native XRSTOR is right to accept bit 3, and the expectation only holds on hosts without MPX state in XCR0, such as Zen2, the target. The failure is on the **native** side, before the translation is compared. ### Environment Windows 11 Pro 26100.9168, Intel Core i7-6820HQ (Skylake, MPX), MSVC 19.52. Measured with `_xgetbv(0)` and `__cpuidex` in a small source-built probe. ### Possible directions (for the fixture owner) - Derive the invalid XCOMP_BV bits from the host's XCR0, for example the lowest bits above 2 that XCR0 does *not* enable, rather than fixing bits 3 and 4. - Or skip the native comparison of exactly those cases (77, named) when XCR0 has them, and keep the translated refusal. I haven't changed anything here. I'm happy to rerun on this host. This report was prepared with AI assistance.
R0Y00 commented 2026-11-24 17:02:05 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T16:05:41Z.


Thanks for checking the native side and for reporting XCR0. Keep the translated profile refusal for the fixed guest-unsupported components. For the native fault comparison, select a component in the usable header bit range that the measured host XCR0 actually disables, keeping the rest of the header and request valid. Please report the selected bit and native exception alongside the existing valid restore control. If you can retest the eventual candidate on the MPX-enabled host, that will cover the configuration missing from the original comparison.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7137108055 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1647#issuecomment-7137108055). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T16:05:41Z. --- Thanks for checking the native side and for reporting XCR0. Keep the translated profile refusal for the fixed guest-unsupported components. For the native fault comparison, select a component in the usable header bit range that the measured host XCR0 actually disables, keeping the rest of the header and request valid. Please report the selected bit and native exception alongside the existing valid restore control. If you can retest the eventual candidate on the MPX-enabled host, that will cover the configuration missing from the original comparison.
legacy-code-archaeologist commented 2026-11-24 17:02:07 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-24T16:25:13Z.


I'll retest the candidate on this MPX host (XCR0 0x1f, Skylake, Windows 11 26100) once it's up. If nobody who owns the fixture takes it, I can also make the change myself, as you described: pick an XCOMP_BV bit in the usable header range that the host XCR0 disables, report the bit and the native exception next to the valid restore control, and keep the translated refusal for the fixed guest-unsupported components. Just say if I should.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7137636530 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1647#issuecomment-7137636530). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-24T16:25:13Z. --- I'll retest the candidate on this MPX host (XCR0 0x1f, Skylake, Windows 11 26100) once it's up. If nobody who owns the fixture takes it, I can also make the change myself, as you described: pick an XCOMP_BV bit in the usable header range that the host XCR0 disables, report the bit and the native exception next to the valid restore control, and keep the translated refusal for the fixed guest-unsupported components. Just say if I should.
R0D4X commented 2026-11-24 17:02:09 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0D4X on 2026-11-24T16:48:56Z.


I'd like to take this one — I'll put together a PR following R0Y00's spec (dynamically selecting a disabled XCR0 bit in the usable header range for the native #GP check, reporting the chosen bit + exception alongside the valid restore control, and keeping the translated profile refusal), plus a synthetic test for XCR0=0x1f.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7138248812 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1647#issuecomment-7138248812). Originally posted by [R0D4X](https://github.com/R0D4X) on 2026-11-24T16:48:56Z. --- I'd like to take this one — I'll put together a PR following R0Y00's spec (dynamically selecting a disabled XCR0 bit in the usable header range for the native #GP check, reporting the chosen bit + exception alongside the valid restore control, and keeping the translated profile refusal), plus a synthetic test for XCR0=0x1f.
Sign in to join this conversation.
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#1640
No description provided.