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.133.124]) by sourceware.org (Postfix) with ESMTPS id BDBA93858D3C for ; Thu, 14 Jul 2022 19:03:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BDBA93858D3C Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-516-KAc2QxegORCyhGpMKR5erw-1; Thu, 14 Jul 2022 15:03:17 -0400 X-MC-Unique: KAc2QxegORCyhGpMKR5erw-1 Received: by mail-qv1-f69.google.com with SMTP id d18-20020a0cfe92000000b0047342562073so1790426qvs.1 for ; Thu, 14 Jul 2022 12:03:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:organization:in-reply-to :content-transfer-encoding; bh=rQoTG67kzzQhIuWShcvAY5vE5PLIWP5WcrKRaN14vm0=; b=aPoHEk83E7kG8xTt14/h5GWLav650Ry8u0/6v+qcnG9lB23/QWiD1YqHVekc0pBndf NxeMehQSKnqAs164t+oMzibmCa3VDaTcXLCVCP3b6FThW0ZBzAdtkvoPoQ7mFoIppAHe zbLMKK5pGFzCTMfMeUEo1tjvr0fpB1Vjd1vRI15VnY5ZMxSh3Tb6ye46ym3VOzbeHRGr I3j7t3sQCrylU53bEhCTCxaVmsMsh7wAmHfsqVJQ0Fw5SW56oPFbwkYuhR7Gj1mMNqXc VdnqEcGe9SX2gqCrDibFDXVClcP2hBhfht67UMo7EYBDS8tqXNRvyQ9Zp+lUzNLK+xMR Ws8Q== X-Gm-Message-State: AJIora/S3kPdGcDoQ6jRaCCgY8s38yv053LOJAfmtqz4jZd+l2xcXNFT AnwIa8MJ/42ocK/MmKnm60sQvHRMvZr0WMXFWkevjmN1IwqU4n4ViPhy7/V7ewQm84hCu5vodXI Ys62HbU6P8mb1T73JPfDP X-Received: by 2002:a0c:da8d:0:b0:472:f799:31ef with SMTP id z13-20020a0cda8d000000b00472f79931efmr9089537qvj.129.1657825396612; Thu, 14 Jul 2022 12:03:16 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tdk1Ryt7XTI9e2tEyc8L1VJrMFut5ThmdsXpHEqOqwnmPp9vzbMIZzeG4kRPYXwE1MISBZCA== X-Received: by 2002:a0c:da8d:0:b0:472:f799:31ef with SMTP id z13-20020a0cda8d000000b00472f79931efmr9089502qvj.129.1657825396144; Thu, 14 Jul 2022 12:03:16 -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 w23-20020a05620a0e9700b006afc53e0be2sm1829318qkm.117.2022.07.14.12.03.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Jul 2022 12:03:15 -0700 (PDT) Message-ID: Date: Thu, 14 Jul 2022 15:03:13 -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: return UNSUPPORTED in tst-mount if support_become_root fails To: Adhemerval Zanella Netto , Michael Hudson-Doyle , libc-alpha@sourceware.org References: <20220714032325.3899142-1-michael.hudson@canonical.com> From: Carlos O'Donell Organization: Red Hat In-Reply-To: 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.1 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_NONE, 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: Thu, 14 Jul 2022 19:03:20 -0000 On 7/14/22 07:24, Adhemerval Zanella Netto via Libc-alpha wrote: > > > On 14/07/22 00:23, Michael Hudson-Doyle via Libc-alpha wrote: >> Otherwise the test fails if run in a chroot by a non-root user: >> >> warning: could not become root outside namespace (Operation not permitted) >> ../sysdeps/unix/sysv/linux/tst-mount.c:36: numeric comparison failure >> left: 1 (0x1); from: errno >> right: 19 (0x13); from: ENODEV >> error: ../sysdeps/unix/sysv/linux/tst-mount.c:39: not true: fd != -1 >> error: ../sysdeps/unix/sysv/linux/tst-mount.c:46: not true: r != -1 >> error: ../sysdeps/unix/sysv/linux/tst-mount.c:48: not true: r != -1 >> ../sysdeps/unix/sysv/linux/tst-mount.c:52: numeric comparison failure >> left: 1 (0x1); from: errno >> right: 9 (0x9); from: EBADF >> error: ../sysdeps/unix/sysv/linux/tst-mount.c:55: not true: mfd != -1 >> ../sysdeps/unix/sysv/linux/tst-mount.c:58: numeric comparison failure >> left: 1 (0x1); from: errno >> right: 2 (0x2); from: ENOENT >> error: ../sysdeps/unix/sysv/linux/tst-mount.c:61: not true: r != -1 >> ../sysdeps/unix/sysv/linux/tst-mount.c:65: numeric comparison failure >> left: 1 (0x1); from: errno >> right: 2 (0x2); from: ENOENT >> error: ../sysdeps/unix/sysv/linux/tst-mount.c:68: not true: pfd != -1 >> error: ../sysdeps/unix/sysv/linux/tst-mount.c:75: not true: fd_tree != -1 >> ../sysdeps/unix/sysv/linux/tst-mount.c:88: numeric comparison failure >> left: 1 (0x1); from: errno >> right: 38 (0x26); from: ENOSYS >> error: 12 test failures >> --- >> sysdeps/unix/sysv/linux/tst-mount.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/sysdeps/unix/sysv/linux/tst-mount.c b/sysdeps/unix/sysv/linux/tst-mount.c >> index 502d7e3433..bd75c9e704 100644 >> --- a/sysdeps/unix/sysv/linux/tst-mount.c >> +++ b/sysdeps/unix/sysv/linux/tst-mount.c >> @@ -103,7 +103,8 @@ subprocess (void) >> static int >> do_test (void) >> { >> - support_become_root (); >> + if (!support_become_root ()) >> + FAIL_UNSUPPORTED("could not become root"); >> > > I think the usual way is to check if process can chroot: > > support_become_root (); > if (!support_can_chroot ()) > return EXIT_UNSUPPORTED; > > As done by other tests. Agreed. We need this same fix for Fedora. I didn't catch this in my review. >> pid_t pid = xfork (); >> if (pid == 0) > -- Cheers, Carlos.