From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 3F6BA3858C2F for ; Mon, 15 Aug 2022 14:23:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3F6BA3858C2F Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-361-1_nU4xc_N4WinZ2Hg5H_yA-1; Mon, 15 Aug 2022 10:23:12 -0400 X-MC-Unique: 1_nU4xc_N4WinZ2Hg5H_yA-1 Received: by mail-qt1-f200.google.com with SMTP id e30-20020ac8011e000000b00342f61e67aeso6288254qtg.3 for ; Mon, 15 Aug 2022 07:23:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc; bh=9ACgBsSyaqCBAxK7OZ5LOKpMYcbKMKh1uzvv0te8Iq8=; b=gBrPslt8gxB/L68sFLQLcedTyAxv7xXh5ZRxeyNIq3UVdgcl8PWFiy+txb6LcK2HiD kVO+xWpgfSY8yhj+cEcK5mHLla/VqroSXslm9UhoRFCg9xp4jhPfzbfwhkU2xPAqs83v mbAyzLucHq/PHlD7VjvEniTj8wnupW1JZ2wJhThnD5uo4HpNU5KTXbCS8Wi5GJPBOzBL A4525m/bSfHN93YBGk6k2HjBGmO+4zMG4LKeSeJQKTjzwqRYzpcMWLxXOMBAYLb5zYEU LF9kPGPt6HD8rWFMOSSe5edxrmYqL0aUP4FDZAo7DWCxxxnCZ3wWz5US/wMNVjoJxR/e xDtQ== X-Gm-Message-State: ACgBeo2wm0G3OSBiS6WMpVOvG+mX2p/HzkpvQD6LCM8tnOU41vzyC6K2 KTvHVVQV9a6k11Bud36DcV4VOH7Z28e2g//LvnzOlE2u73hjoHbFfRjoxc0SNcW/aovlGAFsFgP Q72ud4i7hUv61KYDM+PPK X-Received: by 2002:a05:620a:2548:b0:6b6:113d:34fd with SMTP id s8-20020a05620a254800b006b6113d34fdmr11273791qko.132.1660573392128; Mon, 15 Aug 2022 07:23:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR5rY+mzrZq/g3SkYQ7kxZiQpZDR0mUW8ikLmFCmY65aOMcyX7JmFDng88aFZNk8LaM5JWrxEA== X-Received: by 2002:a05:620a:2548:b0:6b6:113d:34fd with SMTP id s8-20020a05620a254800b006b6113d34fdmr11273775qko.132.1660573391869; Mon, 15 Aug 2022 07:23:11 -0700 (PDT) Received: from [192.168.0.241] (192-0-145-146.cpe.teksavvy.com. [192.0.145.146]) by smtp.gmail.com with ESMTPSA id s12-20020a05620a29cc00b006b6757a11fcsm9642584qkp.36.2022.08.15.07.23.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Aug 2022 07:23:11 -0700 (PDT) Message-ID: <788eb46d-cfe9-cdcf-86fe-a3e366193eff@redhat.com> Date: Mon, 15 Aug 2022 10:23:10 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] Linux: Terminate subprocess on late failure in tst-pidfd (bug 29485) To: Florian Weimer , libc-alpha@sourceware.org Cc: Mark Wielaard , freswa@archlinux.org References: <87tu6ejcbe.fsf@oldenburg.str.redhat.com> From: Carlos O'Donell Organization: Red Hat In-Reply-To: <87tu6ejcbe.fsf@oldenburg.str.redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, 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: , X-List-Received-Date: Mon, 15 Aug 2022 14:23:15 -0000 On 8/15/22 01:38, Florian Weimer via Libc-alpha wrote: > --- > sysdeps/unix/sysv/linux/tst-pidfd.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/sysdeps/unix/sysv/linux/tst-pidfd.c b/sysdeps/unix/sysv/linux/tst-pidfd.c > index 037af22290..5711d1c312 100644 > --- a/sysdeps/unix/sysv/linux/tst-pidfd.c > +++ b/sysdeps/unix/sysv/linux/tst-pidfd.c > @@ -147,8 +147,11 @@ do_test (void) > may be denied if the process doesn't have CAP_SYS_PTRACE or > if a LSM security_ptrace_access_check denies access. */ > if (fd == -1 && errno == EPERM) > - FAIL_UNSUPPORTED ("don't have permission to use pidfd_getfd on pidfd, " > - "skipping test"); > + { > + TEST_COMPARE (pidfd_send_signal (pidfd, SIGKILL, NULL, 0), 0); > + FAIL_UNSUPPORTED ("don't have permission to use pidfd_getfd on pidfd, " > + "skipping test"); > + } > TEST_VERIFY (fd > 0); > > char *path = xasprintf ("/proc/%d/fd/%d", pid, remote_fd); > I reviewed the original and missed this. Thanks. On line 107 we fork the new process. On line 150 we are testing for the unsupported failure but the child process is still alive. You add the termination via TEST_COMPARE sending SIGKILL via pidfd_send_signal. LGTM. Reviewed-by: Carlos O'Donell -- Cheers, Carlos.