On Wed, Dec 13, 2017 at 04:40:11PM +0100, Florian Weimer wrote: > On 12/13/2017 04:22 PM, Dave Hansen wrote: > >On 12/13/2017 07:08 AM, Florian Weimer wrote: > >>Okay, this model is really quite different from x86. Is there a > >>good reason for the difference? > > > >Yes, both implementations are simple and take the "natural" behavior. > >x86 changes XSAVE-controlled register values on entering a signal, so we > >let them be changed (including PKRU). POWER hardware does not do this > >to its PKRU-equivalent, so we do not force it to. > > Whuy? Is there a technical reason not have fully-aligned behavior? > Can POWER at least implement the original PKEY_ALLOC_SETSIGNAL > semantics (reset the access rights for certain keys before switching > to the signal handler) in a reasonably efficient manner? This can be done on POWER. I can also change the behavior on POWER to exactly match x86; i.e reset the value to init value before calling the signal handler. But I think, we should clearly define the default behavior, the behavior when no flag is specified. Applications tend to rely on default behavior and expect the most intuitive behavior to be the default behavior. I tend to think; keeping my biases aside, that the most intuitive behavior is to preserve access/write permissions of any key, i.e not reset to the init value. If the application has set the permissions of a key to some value, it would'nt expect anyone to change them, irrespective of which context it is in. RP