From patchwork Sun Jun 26 20:59:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 55417 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4C0413850202 for ; Sun, 26 Jun 2022 21:11:15 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 2D7AB38515F6 for ; Sun, 26 Jun 2022 21:10:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2D7AB38515F6 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from reform (deer0x0e.wildebeest.org [172.31.17.144]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 21B5830005B6; Sun, 26 Jun 2022 23:10:37 +0200 (CEST) Received: by reform (Postfix, from userid 1000) id 066A62E83468; Sun, 26 Jun 2022 23:10:37 +0200 (CEST) From: Mark Wielaard To: libc-alpha@sourceware.org Subject: [PATCH 2/4] tst-pkey.c: Handle no permission to alloc memory protection keys Date: Sun, 26 Jun 2022 22:59:13 +0200 Message-Id: <20220626205915.33201-3-mark@klomp.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220626205915.33201-1-mark@klomp.org> References: <20220626205915.33201-1-mark@klomp.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Wielaard Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" 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);