Preserve Linux xstate in exception contexts#556
Merged
Conversation
Contributor
Author
|
I made a small example here: https://github.com/luciusmagn/xsave-failure |
xrme
requested changes
Jul 15, 2026
xrme
left a comment
Member
There was a problem hiding this comment.
Please write a comment about the source of magic number words and the purpose of the other constants and then this will be ready to merge
A nice change. If you want to make a similar, separate change for 32-bit x86, I'll be happy to accept that.
luciusmagn
force-pushed
the
lho/fix/linux-x86-64-xstate
branch
from
July 19, 2026 10:34
11bfbb9 to
ac42534
Compare
Contributor
Author
Thanks a lot, I have added support for 32-bit x86, please check it out whenever you can :) |
xrme
approved these changes
Jul 20, 2026
Member
|
Thank you for the patch. |
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.
Hi guys,
this is my first time contributing to Clozure, so I am not sure if there is a process I am forgetting.
I am submitting a (maybe a little opinionated) small fix for xstate handling.
On x86-64, the interrupted CPU register is carried by signals in a signal frame, and modern CPUs have AVX/other extended register state stored in the XSAVE area (see https://criu.org/Xsave, https://www.kernel.org/doc/html/latest/arch/x86/xstate.html, https://github.com/torvalds/linux/blob/master/arch/x86/include/uapi/asm/sigcontext.h).
Atm, when relocating a signal context, CCL copies only the old fixed-size FP/SSE portion of the frame. The copy can still advertise an extended XSAVE area that it does not contain, causing AVX and other extended register state to be discarded on signal return.
This should not break anything, if the extended metadata is missing or invalid, we copy the fp/sse portion and clear the marker so linux treats it as legacy.
I believe this is tangentially related to #85 which shows a bad frame crash as well. This should probably be fixed on x86-32 as well, I can do it if yall want.
Thank you for your time