Re: [PATCH 1/9] x86, pkeys: do not special case protection key 0
From: Dave Hansen
Date: Mon Mar 26 2018 - 13:39:21 EST
On 03/26/2018 10:35 AM, Ram Pai wrote:
>> #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
>> if (cpu_feature_enabled(X86_FEATURE_OSPKE)) {
>> - /* pkey 0 is the default and always allocated */
>> + /* pkey 0 is the default and allocated implicitly */
>> mm->context.pkey_allocation_map = 0x1;
> In the second patch, you introduce DEFAULT_KEY. Maybe you
> should introduce here and express the above code as
>
> mm->context.pkey_allocation_map = (0x1 << DEFAULT_KEY);
>
> Incase your default key changes to something else, you are still good.
That's a good cleanup, but I'd rather limit _this_ set to bug fixes.