On Tue, Nov 07, 2017 at 08:32:16AM +0100, Florian Weimer wrote:
(Dave Hansen: please correct me if I miss-speak below)
As per the current semantics of sys_pkey_free(); the way I understand it, the calling thread is saying disassociate me from this key. Other threads continue to be associated with the key and could continue to get key-faults, but this calling thread will not get key-faults on that key any more.
Also the key should not get reallocated till all the threads in the process have disassocated from the key; by calling sys_pkey_free().
From that point of view, I think there is a bug in the implementation of
pkey on x86 and now on powerpc aswell.
Sorry. I was not thinking right. Let me restate.
A key is a global resource, but the permissions on a key is local to a thread. For eg: the same key could disable access on a page for one thread, while it could disable write on the same page on another thread.
thanks. will try the test case with my kernel patches. But, on powerpc one can change the permissions on the key in the signal handler which takes into effect immediately, there should not be a bug in powerpc.
x86 has this requirement where it has to return from the signal handler back to the kernel in order to change the permission on a key, it can cause issues with longjump.
RP
-- To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 11/07/2017 02:39 PM, Ram Pai wrote:
As per the current semantics of sys_pkey_free(); the way I understand it, the calling thread is saying disassociate me from this key.
No. It is saying: "this *process* no longer has any uses of this key, it can be reused". -- To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
linux-kselftest-mirror@lists.linaro.org