Re: pkeys: Support setting access rights for signal handlers
From: Ram Pai <hidden>
Date: 2017-12-12 23:13:37
Also in:
linux-arch, linux-mm
On Mon, Dec 11, 2017 at 08:13:12AM -0800, Dave Hansen wrote:
On 12/09/2017 10:42 PM, Florian Weimer wrote:quoted
quoted
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.Let's check with the other implementation... Ram, this is a question about the signal handler behavior on POWER. I thought you ended up having different behavior in signal handlers than x86.
On POWER, the value of the pkey_read() i.e contents the AMR register(pkru equivalent), is always the same regardless of its context; signal handler or not. In other words, the permission of any allocated key will not reset in a signal handler context. I was not aware that x86 would reset the key permissions in signal handler. I think, the proposed behavior for PKEY_ALLOC_SETSIGNAL should actually be the default behavior. RP