[PATCH 2/4] tst-pkey.c: Handle no permission to alloc memory protection keys
Mark Wielaard
mark@klomp.org
Sun Jun 26 20:59:13 GMT 2022
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);
--
2.30.2
More information about the Libc-alpha
mailing list