[PATCH] Fix tst-aarch64-pkey to handle ENOSPC as not supported
Florian Weimer
fweimer@redhat.com
Fri Feb 14 12:30:37 GMT 2025
* Aurelien Jarno:
> The syscall pkey_alloc can return ENOSPC to indicate either that all
> keys are in use or that the system runs in a mode in which memory
> protection keys are disabled. In such case the test should not fail and
> just return unsupported.
>
> This matches the behaviour of the generic tst-pkey.
> ---
> sysdeps/unix/sysv/linux/aarch64/tst-aarch64-pkey.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/sysdeps/unix/sysv/linux/aarch64/tst-aarch64-pkey.c b/sysdeps/unix/sysv/linux/aarch64/tst-aarch64-pkey.c
> index 3ff33ef72a..c884efc3b4 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/tst-aarch64-pkey.c
> +++ b/sysdeps/unix/sysv/linux/aarch64/tst-aarch64-pkey.c
> @@ -55,6 +55,10 @@ do_test (void)
> if (errno == ENOSYS || errno == EINVAL)
> FAIL_UNSUPPORTED
> ("kernel or CPU does not support memory protection keys");
> + if (errno == ENOSPC)
> + FAIL_UNSUPPORTED
> + ("no keys available or kernel does not support memory"
> + " protection keys");
> FAIL_EXIT1 ("pkey_alloc: %m");
> }
Okay.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Thanks,
Florian
More information about the Libc-alpha
mailing list