aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorLucas A. M. Magalhaes <lamm@linux.ibm.com>2020-01-16 10:39:12 -0300
committerTulio Magno Quites Machado Filho <tuliom@linux.ibm.com>2020-01-17 09:05:03 -0300
commit70ba28f7ab2923d4e36ffc9d5d2e32357353b25c (patch)
treea372da0bc6f7aefadc7b069e40a577e923c1034a /sysdeps/unix
parent18363b4f010da9ba459b13310b113ac0647c2fcc (diff)
downloadglibc-70ba28f7ab2923d4e36ffc9d5d2e32357353b25c.tar
glibc-70ba28f7ab2923d4e36ffc9d5d2e32357353b25c.tar.gz
glibc-70ba28f7ab2923d4e36ffc9d5d2e32357353b25c.tar.bz2
glibc-70ba28f7ab2923d4e36ffc9d5d2e32357353b25c.zip
Fix tst-pkey.c pkey_alloc return checks and manual
This test was failing in some powerpc systems as it was not checking for ENOSPC return. As said on the Linux man-pages and can be observed by the implementation at mm/mprotect.c in the Linux Kernel source. The syscall pkey_alloc can return EINVAL or ENOSPC. ENOSPC will indicate either that all keys are in use or that the kernel does not support pkeys. Reviewed-by: Gabriel F. T. Gomes <gabriel@inconstante.net.br>
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/tst-pkey.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/tst-pkey.c b/sysdeps/unix/sysv/linux/tst-pkey.c
index 4c4fbae3ad..4ea1bc4f9a 100644
--- a/sysdeps/unix/sysv/linux/tst-pkey.c
+++ b/sysdeps/unix/sysv/linux/tst-pkey.c
@@ -197,6 +197,10 @@ do_test (void)
if (errno == EINVAL)
FAIL_UNSUPPORTED
("CPU does not support memory protection keys: %m");
+ if (errno == ENOSPC)
+ FAIL_UNSUPPORTED
+ ("no keys available or kernel does not support memory"
+ " protection keys");
FAIL_EXIT1 ("pkey_alloc: %m");
}
TEST_COMPARE (pkey_get (keys[0]), 0);