[PATCH 2/4] tst-pkey.c: Handle no permission to alloc memory protection keys
Florian Weimer
fw@deneb.enyo.de
Sun Jun 26 21:17:33 GMT 2022
* Mark Wielaard:
> pkey_alloc might fail with errno EPERM if there is no permission
> to allocate memory protection keys. Use FAIL_UNSUPPORTED in that
> case.
> ---
> sysdeps/unix/sysv/linux/tst-pkey.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/sysdeps/unix/sysv/linux/tst-pkey.c b/sysdeps/unix/sysv/linux/tst-pkey.c
> index df51f695bc..48a20fa3e0 100644
> --- a/sysdeps/unix/sysv/linux/tst-pkey.c
> +++ b/sysdeps/unix/sysv/linux/tst-pkey.c
> @@ -203,6 +203,9 @@ do_test (void)
> FAIL_UNSUPPORTED
> ("no keys available or kernel does not support memory"
> " protection keys");
> + if (errno == EPERM)
> + FAIL_UNSUPPORTED
> + ("no permission to alloc memory protection keys");
> FAIL_EXIT1 ("pkey_alloc: %m");
> }
> TEST_COMPARE (pkey_get (keys[0]), 0);
It's rather weird to restrict access to a hardening tool. Is this in
a container, and is the container tool reasonably up to date? They
should all have switchted to ENOSYS for reducing the system call
profile.
More information about the Libc-alpha
mailing list