From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C83D6C47095 for ; Wed, 9 Jun 2021 07:21:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B14106136D for ; Wed, 9 Jun 2021 07:21:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237289AbhFIHXI (ORCPT ); Wed, 9 Jun 2021 03:23:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:38172 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234826AbhFIHXH (ORCPT ); Wed, 9 Jun 2021 03:23:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9A30A6008E; Wed, 9 Jun 2021 07:21:11 +0000 (UTC) Date: Wed, 9 Jun 2021 09:21:08 +0200 From: Christian Brauner To: Hannes Reinecke Cc: "Eric W. Biederman" , gregkh@linuxfoundation.org, containers@lists.linux.dev, linux-kernel@vger.kernel.org, lkml@metux.net Subject: Re: device namespaces Message-ID: <20210609072108.ldhsxfnfql4pacqx@wittgenstein> References: <9157affa-b27a-c0f4-f6ee-def4a991fd4e@suse.de> <20210608142911.ievp2rpuquxjuyus@wittgenstein> <877dj4ff9g.fsf@disp2133> <20210609063818.xnod4rzvti3ujkvn@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 09, 2021 at 09:02:36AM +0200, Hannes Reinecke wrote: > On 6/9/21 8:38 AM, Christian Brauner wrote: > > On Tue, Jun 08, 2021 at 12:16:43PM -0500, Eric W. Biederman wrote: > > > Hannes Reinecke writes: > > > > > > > On 6/8/21 4:29 PM, Christian Brauner wrote: > > > > > On Tue, Jun 08, 2021 at 04:10:08PM +0200, Hannes Reinecke wrote: > [ .. ] > > > > Granted, modifying sysfs layout is not something for the faint-hearted, > > > > and one really has to look closely to ensure you end up with a > > > > consistent layout afterwards. > > > > > > > > But let's see how things go; might well be that it turns out to be too > > > > complex to consider. Can't tell yet. > > > > > > I would suggest aiming for something like devptsfs without the > > > complication of /dev/ptmx. > > > > > > That is a pseudo filesystem that has a control node and virtual block > > > devices that were created using that control node. > > > > Also see android/binder/binderfs.c > > > Ah. Will have a look. I implemented this a few years back and I think it should've made it onto Android by default now. So that approach does indeed work well, it seems: https://chromium.googlesource.com/aosp/platform/system/core/+/master/rootdir/init.rc#257 This should be easier to follow than the devpts case because you don't need to wade through the {t,p}ty layer. > > > > > > > That is the cleanest solution I know and is not strictly limited to use > > > with containers so it can also gain greater traction. The interaction > > > with devtmpfs should be simply having devtmpfs create a mount point for > > > that filesystem. > > > > > > This could be a new cleaner api for things like loopback devices. > > > > I sent a patchset that implemented this last year. > > > Do you have a pointer/commit hash for this? Yes, sure: https://lore.kernel.org/linux-block/20200424162052.441452-1-christian.brauner@ubuntu.com/ You can also just pull my branch. I think it's still based on v5.7 or sm: https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/log/?h=loopfs I'm happy to collaborate on this too. Christian