Re: pkeys: Support setting access rights for signal handlers
From: Florian Weimer <hidden>
Date: 2017-12-10 06:42:28
Also in:
linux-arch, linux-mm
On 12/10/2017 01:17 AM, Dave Hansen wrote:
On 12/09/2017 01:16 PM, Florian Weimer wrote:quoted
The attached patch addresses a problem with the current x86 pkey implementation, which makes default-readable pkeys unusable from signal handlers because the default init_pkru value blocks access.Thanks for looking into this! What do you mean by "default-readable pkeys"? I think you mean that, for any data that needs to be accessed to enter a signal handler, it must be set to pkey=0 with the current implementation. All other keys are inaccessible when entering a signal handler because the "init" value disables access.
Right, and for keys which are readable (but not writable) most of the time, so that date is readable, this breaks things.
My only nit with this is whether it is the *right* interface. The signal vs. XSAVE state thing is pretty x86 specific and I doubt that this will be the last feature that we encounter that needs special signal behavior.
The interface is not specific to XSAVE. To generic code, only the two signal mask manipulation functions are exposed. And I expect that we're going to need that for other (non-x86) implementations because they will have the same issue because the signal handler behavior will be identical. Thanks, Florian