From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bumble.birch.relay.mailchannels.net (bumble.birch.relay.mailchannels.net [23.83.209.25]) by sourceware.org (Postfix) with ESMTPS id 7AEF93858005 for ; Mon, 24 Jan 2022 15:01:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7AEF93858005 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 0AFDF12123B; Mon, 24 Jan 2022 15:01:05 +0000 (UTC) Received: from pdx1-sub0-mail-a304.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 9E6F1121550; Mon, 24 Jan 2022 15:01:02 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a304.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.96.96.39 (trex/6.4.3); Mon, 24 Jan 2022 15:01:05 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Imminent-Thread: 6b8b9d5074d79862_1643036463682_4002737108 X-MC-Loop-Signature: 1643036463678:1144046829 X-MC-Ingress-Time: 1643036463678 Received: from [192.168.1.174] (unknown [1.186.122.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a304.dreamhost.com (Postfix) with ESMTPSA id 4JjCpw4qWyz1PT; Mon, 24 Jan 2022 07:00:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gotplt.org; s=gotplt.org; t=1643036457; bh=N869BOaDga7o1RMAJkOR6G+sF8k=; h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding; b=c+ST6hbxrOYa/xUMDoE0j48rNIaptxXl6/ItpF5gu393KCXhvkFHYxc8LUgg3GHhH 4s62BQooKYc8qKOgwzfJ2cPjP0rFMcwuDXMM7wv3obQpLZNH2ZD9bhCyfUnk+oLR1g 1Zb8mf8WaIcBDdVOz7bQimJVhqjSTFArhXhIB98E= Message-ID: <0c1b56fe-6a4a-57bd-b39e-c06cb9d0b9c7@gotplt.org> Date: Mon, 24 Jan 2022 20:30:51 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH] Linux: Detect user namespace support in io/tst-getcwd-smallbuff Content-Language: en-US To: Florian Weimer , libc-alpha@sourceware.org References: <87fspd2nzl.fsf@oldenburg.str.redhat.com> From: Siddhesh Poyarekar In-Reply-To: <87fspd2nzl.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3037.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_SBL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 24 Jan 2022 15:01:12 -0000 On 24/01/2022 20:13, Florian Weimer via Libc-alpha wrote: > Otherwise the test fails with certain container runtimes. > Thanks, you saved me a few hours; I was just looking at this :) LGTM. Reviewed-by: Siddhesh Poyarekar > --- > sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c b/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c > index d460d6e766..55362f6060 100644 > --- a/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c > +++ b/sysdeps/unix/sysv/linux/tst-getcwd-smallbuff.c > @@ -34,6 +34,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -188,6 +189,23 @@ do_test (void) > xmkdir (MOUNT_NAME, S_IRWXU); > atexit (do_cleanup); > > + /* Check whether user namespaces are supported. */ > + { > + pid_t pid = xfork (); > + if (pid == 0) > + { > + if (unshare (CLONE_NEWUSER | CLONE_NEWNS) != 0) > + _exit (EXIT_UNSUPPORTED); > + else > + _exit (0); > + } > + int status; > + xwaitpid (pid, &status, 0); > + TEST_VERIFY_EXIT (WIFEXITED (status)); > + if (WEXITSTATUS (status) != 0) > + return WEXITSTATUS (status); > + } > + > TEST_VERIFY_EXIT (socketpair (AF_UNIX, SOCK_STREAM, 0, sockfd) == 0); > pid_t child_pid = xclone (child_func, NULL, child_stack, > sizeof (child_stack), >