From: Kevin Brodsky <kevin.brodsky@arm.com>
To: Kurt Lin <lylin1023@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Shuah Khan <shuah@kernel.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>,
Swarup Laxman Kotiaklapudi <swarupkotikalapudi@gmail.com>,
linux-kselftest@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests/proc: proc-empty-vm: handle CPUs without protection keys
Date: Fri, 13 Nov 2026 14:10:46 +0100 [thread overview]
Message-ID: <53e509bd-e6ec-4b09-97b7-eaf9aa6b5797@arm.com> (raw)
In-Reply-To: <20261109151912.156518-1-lylin1023@gmail.com>
On 09/11/2026 16:19, Kurt Lin wrote:
> On x86 CPUs without protection keys, pkey_alloc() fails with ENOSPC,
> as documented in pkey_alloc(2). protection_key_support() only expects
> ENOSYS or EINVAL, so the test fails on such machines, e.g. an Intel
> Core i5-7200U:
It would be good to mention that the x86 implementation had a bug where
the first call to pkey_alloc() would return -EINVAL instead of -ENOSPC.
This was recently fixed by commit dee87e09b0dd ("x86/pkeys: Fix
pkey_alloc() return value when pkeys are not supported"); that's
probably why the issue appeared only now.
-EINVAL is technically not an expected error in this situation, but for
backwards-compatibility with older kernels it probably makes sense to
allow it for a little while.
With the commit message expanded:
Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com>
> protection_key_support: error: rv -1, errno 28
>
> Treat ENOSPC as "no protection key support" as well.
>
> An AI coding assistant (Claude) was used to analyze the failure and to
> draft the fix and this changelog. Tested on v7.4-rc1 on the machine
> above; the test now passes.
>
> Fixes: bf5add391eeb ("proc: test ProtectionKey in proc-empty-vm test")
> Signed-off-by: Kurt Lin <lylin1023@gmail.com>
> ---
> tools/testing/selftests/proc/proc-empty-vm.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tools/testing/selftests/proc/proc-empty-vm.c b/tools/testing/selftests/proc/proc-empty-vm.c
> index b3f898aab4ab..a9d3c973a663 100644
> --- a/tools/testing/selftests/proc/proc-empty-vm.c
> +++ b/tools/testing/selftests/proc/proc-empty-vm.c
> @@ -77,6 +77,9 @@ static int protection_key_support(void)
> } else if (rv == -1 && errno == EINVAL) {
> // ospke=n
> return 0;
> + } else if (rv == -1 && errno == ENOSPC) {
> + // CPU without protection keys
> + return 0;
> } else {
> fprintf(stderr, "%s: error: rv %ld, errno %d\n", __func__, rv, errno);
> exit(EXIT_FAILURE);
next prev parent reply other threads:[~2026-11-13 13:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 15:19 [PATCH] selftests/proc: proc-empty-vm: handle CPUs without protection keys Kurt Lin
2026-11-13 13:10 ` Kevin Brodsky [this message]
2026-11-13 15:44 ` [PATCH v2] " Kurt Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53e509bd-e6ec-4b09-97b7-eaf9aa6b5797@arm.com \
--to=kevin.brodsky@arm.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=lylin1023@gmail.com \
--cc=shuah@kernel.org \
--cc=swarupkotikalapudi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.