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 E594E385803B for ; Thu, 18 Nov 2021 19:56:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E594E385803B Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-473-mW-KthwtP46PeKaomoejAA-1; Thu, 18 Nov 2021 14:56:03 -0500 X-MC-Unique: mW-KthwtP46PeKaomoejAA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3125D10055A7 for ; Thu, 18 Nov 2021 19:56:02 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.131]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 586C51980E; Thu, 18 Nov 2021 19:56:01 +0000 (UTC) From: Florian Weimer To: DJ Delorie Cc: libc-alpha@sourceware.org Subject: Re: [patch v3] Allow for unpriviledged nested containers References: Date: Thu, 18 Nov 2021 20:55:59 +0100 In-Reply-To: (DJ Delorie's message of "Thu, 18 Nov 2021 14:52:04 -0500") Message-ID: <875yspdyr4.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.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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: Thu, 18 Nov 2021 19:56:06 -0000 * DJ Delorie: > Florian Weimer writes: >>> Well, for the pldd test, obviously we do ;-) >> >> Do we? /proc and the PIDs of the processes have to be consistent for >> sure, but do we really need them to be separate from the host? > > It's the consistency that's the problem. If getpid() (which returns a > pid in the child namespace) returns a value that's useless in > /proc/ (because those are pids in the parent namespace) then the > test fails. > > One process can have different PIDs depending on how you look at it. Then elf/tst-pldd should be fine with 4. >>> 1. No /proc >>> 2. /proc in wrong namespace >>> 3. /proc in correct namespace >>> >>> We'd prefer 3, then 1, but not 2? >> >> Yeah, 2 is quite bad for some tests at least. Some thread-exit tests >> will suffer as well, I think, because they read TIDs from >> /proc/self/task. > > 3-then-1 returns us to my original patch, which attempted to mount it in > the child namespace, or failed but let the test run anyway. Sorry, I missed that there is no 3b: 3b. /proc in correct namespace (but host PID namespace) So instead: /* The unshare here gives us our own spaces and capabilities. */ if (unshare (CLONE_NEWUSER | CLONE_NEWPID | CLONE_NEWNS) < 0) This: /* The unshare here gives us our own spaces and capabilities. */ if (unshare (CLONE_NEWUSER | CLONE_NEWNS) < 0) Not sure if it will work. CLONE_NEWPID is preferable for better test isolation, but maybe it's still better to run tests with reduced isolation. I think our main goal is the unprivileged chroot, followed by avoiding Netfilter connection tracking table overflow. Thanks, Florian