From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id AF9971F466 for ; Thu, 16 Jan 2020 13:39:20 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; q=dns; s=default; b=qUn YyOBdNhRMKshIeIjL9Zge9N5Qa/91hWHw/2/hqoh7iXMSfJ9WSBAoTlHnOU/yY6q 1co0aQWxW5hv/S75Y1q/VxM56fpt8Y7OJqRXg+cuhoANJjzsVmN+BiO8H8IN4J9f iKRH64EXdFucu8vQr/WOiw2vjaulNJ0pBww1PO3o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; s=default; bh=S2usDUtVU 7sh1e8232ukBApz690=; b=vs5aMUQYnqfiH2EOo8h0C2fgaDrDT6VUWc4LEbKoc llyhUhy79uxe8VM6OHFta3EpyHcCugo9ZY8KJVsmaiFTbIVjpAEI4LJGbCN2PPYh TNxXd56QSkWLZZOW54SomCHXPqhaN2RWxbLq5/qlZHEUBvcmYax6HrTT32RilE7/ 7A= Received: (qmail 109349 invoked by alias); 16 Jan 2020 13:39:18 -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 Received: (qmail 109338 invoked by uid 89); 16 Jan 2020 13:39:17 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mx0a-001b2d01.pphosted.com From: "Lucas A. M. Magalhaes" To: libc-alpha@sourceware.org Cc: tuliom@linux.ibm.com Subject: [PATCH] Fix tst-pkey.c pkey_alloc return checks and manual Date: Thu, 16 Jan 2020 10:39:12 -0300 Message-Id: <20200116133912.2578-1-lamm@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. --- manual/memory.texi | 4 ++++ sysdeps/unix/sysv/linux/tst-pkey.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/manual/memory.texi b/manual/memory.texi index b565dd69f2..aa5011e4f9 100644 --- a/manual/memory.texi +++ b/manual/memory.texi @@ -3288,6 +3288,10 @@ in which memory protection keys are disabled. @item ENOSPC 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 deftypefun 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); -- 2.20.1