From patchwork Sun Jun 26 20:59:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 55418 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 68B713850879 for ; Sun, 26 Jun 2022 21:11:36 +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 302613850225 for ; Sun, 26 Jun 2022 21:10:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 302613850225 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 25BA330005B6; Sun, 26 Jun 2022 23:10:41 +0200 (CEST) Received: by reform (Postfix, from userid 1000) id 087BA2E83468; Sun, 26 Jun 2022 23:10:41 +0200 (CEST) From: Mark Wielaard To: libc-alpha@sourceware.org Subject: [PATCH 3/4] tst-pidfd.c: Test is UNSUPPORTED without PTRACE_MODE_ATTACH_REALCREDS Date: Sun, 26 Jun 2022 22:59:14 +0200 Message-Id: <20220626205915.33201-4-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" pidfd_getfd will fail with errno EPERM if the calling process did not have PTRACE_MODE_ATTACH_REALCREDS permissions. Use FAIL_UNSUPPORTED in that case. --- sysdeps/unix/sysv/linux/tst-pidfd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sysdeps/unix/sysv/linux/tst-pidfd.c b/sysdeps/unix/sysv/linux/tst-pidfd.c index d93b6faa6f..28349b2f91 100644 --- a/sysdeps/unix/sysv/linux/tst-pidfd.c +++ b/sysdeps/unix/sysv/linux/tst-pidfd.c @@ -95,8 +95,10 @@ do_test (void) kernel has pidfd support that we can test. */ int r = pidfd_getfd (0, 0, 1); TEST_VERIFY_EXIT (r == -1); - if (errno == ENOSYS) - FAIL_UNSUPPORTED ("kernel does not support pidfd_getfd, skipping test"); + if (errno == ENOSYS || errno == EPERM) + FAIL_UNSUPPORTED ("kernel does not support pidfd_getfd," + " or we don't have PTRACE_MODE_ATTACH_REALCREDS" + " permissions, skipping test"); } ppid = getpid ();