Re: [PATCH 1/9] x86, pkeys: do not special case protection key 0

From: Dave Hansen
Date: Mon Mar 26 2018 - 13:53:45 EST


On 03/26/2018 10:47 AM, Shuah Khan wrote:
>
> Also what happens "pkey_free() pkey-0" - can you elaborate more on that
> "silliness consequences"

It's just what happens if you free any other pkey that is in use: it
might get reallocated later. The most likely scenario is that you will
get pkey-0 back from pkey_alloc(), you will set an access-disable or
write-disable bit in PKRU for it, and your next stack access will SIGSEGV.