From patchwork Wed Jan 3 16:03:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 25193 Received: (qmail 17055 invoked by alias); 3 Jan 2018 16:03:29 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 17037 invoked by uid 89); 3 Jan 2018 16:03:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*r:121, H*MI:27040 X-HELO: hall.aurel32.net From: Aurelien Jarno To: libc-alpha@sourceware.org Cc: Aurelien Jarno Subject: [PATCH] tst-pkey: fix detection of CPU support Date: Wed, 3 Jan 2018 17:03:20 +0100 Message-Id: <20180103160320.27040-1-aurelien@aurel32.net> The current tst-pkey.c checks for CPU support using the pkey_alloc function/syscall and test for EINVAL. In practice ENOSPC can also be returned. Looking at the kernel code it seems to happen for architectures which have activated the syscall, but do not have kernel support yet. This is consistent with the Linux Programmer's Manual, which says that ENOSPC can be returned "if the processor or operating system does not support protection keys". This patch simply tests for EINVAL in addition to ENOSPC. This fixes misc/tst-pkey on mipsel-linux-gnu. Changelog: * sysdeps/unix/sysv/linux/tst-pkey.c (do_test): Test for CPU support using ENOSPC in addition to EINVAL. --- ChangeLog | 5 +++++ sysdeps/unix/sysv/linux/tst-pkey.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 68b8c93ccc..c5f6f273b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-01-03 Aurelien Jarno + + * sysdeps/unix/sysv/linux/tst-pkey.c (do_test): Test for CPU support + using ENOSPC in addition to EINVAL. + 2018-01-02 Wilco Dijkstra * math/math.h (math_errhandling): Set to 0 with __FAST_MATH__. diff --git a/sysdeps/unix/sysv/linux/tst-pkey.c b/sysdeps/unix/sysv/linux/tst-pkey.c index 5f721d4444..4204e1c3a3 100644 --- a/sysdeps/unix/sysv/linux/tst-pkey.c +++ b/sysdeps/unix/sysv/linux/tst-pkey.c @@ -194,7 +194,7 @@ do_test (void) if (errno == ENOSYS) FAIL_UNSUPPORTED ("kernel does not support memory protection keys"); - if (errno == EINVAL) + if (errno == EINVAL || errno == ENOSPC) FAIL_UNSUPPORTED ("CPU does not support memory protection keys: %m"); FAIL_EXIT1 ("pkey_alloc: %m");