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 99E273857BBD for ; Fri, 15 Jul 2022 15:44:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 99E273857BBD Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-37-LZHkbgxkMKKlGXV45ciSrg-1; Fri, 15 Jul 2022 11:44:27 -0400 X-MC-Unique: LZHkbgxkMKKlGXV45ciSrg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D41461C06EDB for ; Fri, 15 Jul 2022 15:44:26 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.60]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 08B3BC04482; Fri, 15 Jul 2022 15:44:25 +0000 (UTC) From: Florian Weimer To: Carlos O'Donell Cc: Michael Hudson-Doyle via Libc-alpha Subject: Re: [PATCH v2] linux: return UNSUPPORTED in tst-mount if !support_can_chroot References: <20220714032325.3899142-1-michael.hudson@canonical.com> <20220715000657.1712606-1-michael.hudson@canonical.com> <8735f2onve.fsf@oldenburg.str.redhat.com> <9241f7ef-0709-cb1f-f220-0b8f16e7adb9@redhat.com> Date: Fri, 15 Jul 2022 17:44:24 +0200 In-Reply-To: <9241f7ef-0709-cb1f-f220-0b8f16e7adb9@redhat.com> (Carlos O'Donell's message of "Fri, 15 Jul 2022 11:35:45 -0400") Message-ID: <8735f2mld3.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP 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: Fri, 15 Jul 2022 15:44:32 -0000 * Carlos O'Donell: >> I think you should call and check support_enter_mount_namespace instead, >> to make sure that the test does not modify the original mount namespace. > > Like this in the child? > > diff --git a/sysdeps/unix/sysv/linux/tst-mount.c b/sysdeps/unix/sysv/linux/tst-mount.c > index 502d7e3433..d19d70d42d 100644 > --- a/sysdeps/unix/sysv/linux/tst-mount.c > +++ b/sysdeps/unix/sysv/linux/tst-mount.c > @@ -107,7 +107,11 @@ do_test (void) > > pid_t pid = xfork (); > if (pid == 0) > - subprocess (); > + { > + if (!support_enter_mount_namespace ()) > + FAIL_UNSUPPORTED ("could not enter new mount namespace"); > + subprocess (); > + } Yes, except that you need to change xwaitpid (pid, &status, 0); TEST_VERIFY (WIFEXITED (status)); as well, to handle status 77. I'm not entirely sure the fork is necessary, though. Thanks, Florian