Re: [PATCH] x86/pkeys: Fix pkey_alloc return value when pkeys are not supported
From: Dave Hansen
Date: Thu Jul 16 2026 - 18:38:01 EST
On 7/16/26 15:06, Bijan Tabatabai wrote:
> Change mm_pkey_alloc() to directly check if OSPKE is enabled, and
> return -1 if it is not, which causes pkey_alloc() to return -ENOSPC. The
> arm64 and powerpc implementations of mm_pkey_alloc() already do this
> check.
Thanks for the patch! I made one tweak which was to use
arch_pkeys_enabled() instead of the cpu_feature_enabled() check. That
makes the code darn close to a perfect copy of the ARM code at least.
It would be really nice if someone could go consolidate all the copying
and pasting between the architectures there some day.