Re: [PATCH V8 09/44] x86/pkeys: Enable PKS on cpus which support it

From: Dave Hansen
Date: Fri Jan 28 2022 - 18:53:26 EST


On 1/28/22 15:41, Ira Weiny wrote:
> On Fri, Jan 28, 2022 at 03:18:29PM -0800, Dave Hansen wrote:
>> On 1/27/22 09:54, ira.weiny@xxxxxxxxx wrote:
>>> Initially, pks_setup() initializes the per-cpu MSR with 0 to enable all
>>> access on all pkeys.
>>
>> Why not just make it restrictive to start out? That's what we do for PKU.
>
> This maintains compatibility with the code prior to this patch. Ie no
> restrictions on kernel mappings.

But, compatibility with what? At this point, there are no non-pkey-0
kernel mappings. So, PKRS can be set to anything as long as the two low
bits are clear.