Re: [RFC PATCH v2 1/1] x86/pkeys: update PKRU to enable pkey 0 before XSAVE

From: jeffxu
Date: Thu Apr 25 2024 - 18:09:04 EST


From: Jeff Xu <jeffxu@xxxxxxxxxxxx>

>The semantics you've implemented for sigaltstacks are not the only possible
>ones. In principle, a signal handler with its own stack might want to have
>its own key(s) enabled. In a way a Linux signal handler is a mini-thread
>created on the fly, with its own stack and its own attributes. Some thought
>& analysis should go into which way to go here, and the best path should be
>chosen. Fixing the SIGSEGV you observed should be a happy side effect of
>other worthwile improvements.
>
This is exactly right. we wants to use altstack with its own pkey. The pkey
won't be writeable during thread's normal operation, only by signaling
handling itself.

Thanks
-Jeff

>Thanks,
>
> Ingo
>