Repository navigation
fix(libc): report Windows kernels that omit AVX state from exception contexts - #33
Merged
Merged
Conversation
…ws 11 kernels Windows 11 24H2/25H2 kernels before 26100.7920 (and Windows Server 2025) can build a user-mode exception's context from a stale XSAVE header left on the stack (JDK-8365196). The context then omits AVX state the thread uses, and resuming from it zeroes the upper halves of ymm0-15 and the AVX-512 state. A guest store that faults on a write-watched page and is resumed by ReportCrash then writes zeros where those halves belong. The vectored handler now takes an XSAVE of the vector components on entry, and before an EXCEPTION_CONTINUE_EXECUTION writes the components in use that the context omits back into its XSAVE area and fixes the header, so the resume restores them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On Windows 11 24H2/25H2 kernels before 26100.7920 (OS build 26100.7922, KB5077241), and on Windows Server 2025, the kernel can build a user-mode exception's context from a stale XSAVE header left on the stack (JDK-8365196, reproducer and kernel survey). The context then omits the AVX state the thread is using. The upper halves of ymm0-15 and the AVX-512 state are already zero when a vectored handler runs, and the resume keeps them zero.
A converted PS4 title (GT7) crashed this way when Ryty resumed a guest write fault: a job object's two 256-bit stores lost their upper 16 bytes. On the player's Windows 11 26200.5761, the resumed contexts had
XSTATE_BV 0andXCOMP_BV 0x8000000000000000, a stale -0.0/INT64_MIN on the stack.This can't be repaired from user mode. The first version of this PR wrote the components back from an XSAVE taken in the handler. On the affected machine, AVX was already not in use (XINUSE) at that point, so there was nothing to write back. That repair is removed.
What the PR does now:
ReportCrashCheckingXState. WhenReportCrashresumes an exception (EXCEPTION_CONTINUE_EXECUTION), it checks whether the context's compacted XSAVE header omits enabled vector components (XCR0 bits 2, 5, 6, 7). It only reads the context.docs/dev/TechnicalDebt.mdrecords the check and when it can go.Tested
CrashReport.cppcompiles with-std=c++20 -Wall, no warnings.PAGE_READONLYpage with a complete context is not reported. The same fault, with the context's header set to what an affected kernel produces (XSTATE_BV 0,XCOMP_BV 0x8000000000000000), is reported with0xe4omitted.ctestsuite was not run (no MSYS2 UCRT64 environment here). No title was run against this branch.Checklist
main🤖 Generated with Claude Code