mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-05 19:35:52 +03:00
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>
This commit is contained in:
committed by
Tulio Magno Quites Machado Filho
parent
18363b4f01
commit
70ba28f7ab
@@ -3288,6 +3288,10 @@ in which memory protection keys are disabled.
|
|||||||
|
|
||||||
@item ENOSPC
|
@item ENOSPC
|
||||||
All available protection keys already have been allocated.
|
All available protection keys already have been allocated.
|
||||||
|
|
||||||
|
The system does not implement memory protection keys or runs in a mode
|
||||||
|
in which memory protection keys are disabled.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
|
@@ -197,6 +197,10 @@ do_test (void)
|
|||||||
if (errno == EINVAL)
|
if (errno == EINVAL)
|
||||||
FAIL_UNSUPPORTED
|
FAIL_UNSUPPORTED
|
||||||
("CPU does not support memory protection keys: %m");
|
("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");
|
FAIL_EXIT1 ("pkey_alloc: %m");
|
||||||
}
|
}
|
||||||
TEST_COMPARE (pkey_get (keys[0]), 0);
|
TEST_COMPARE (pkey_get (keys[0]), 0);
|
||||||
|
Reference in New Issue
Block a user