Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6155780ybf; Thu, 5 Mar 2020 14:22:25 -0800 (PST) X-Google-Smtp-Source: ADFU+vsjpH23fphpJNY/r9eD9t5jTH8E+nw+NBBKMeg6pRD74Q63/We4gjMFozxM+ERaVBwK97xJ X-Received: by 2002:aca:f449:: with SMTP id s70mr43279oih.86.1583446945427; Thu, 05 Mar 2020 14:22:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583446945; cv=none; d=google.com; s=arc-20160816; b=vOuZ/elHnAxthmRrPoUOZiPmVUfMxyx6rm1xbjqaajOnJ6/g7h3e0DYR7b1Dk0jpFA z+A9EVoEwp5NyeLYauhfldD/fWUwZak7riF14zFDNcgPHYS5Rwi/aPZ9Np4oHBd4YZji CCKbuY3tqTW7k+ay4kJQhUP0ttRp7RW6axPeGMsaiUCuTa4aUPKGnxLQjC3KlaLY8XWK S2h4+Q8MrhnAnEyWeMCgoLCKTjnD7OfRfM6X2LfahsWDOxsmFaaUtw2X2tU/97FdMG1j sCeFhyzjQGQwiDlGcGvacN5Ix9E7Ho8prXIV5eo57wBqAbMxUDHGqQvIThDIlLrO4DkX orwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature; bh=Hjtx1RhxIJ79+HtjekmYaD6b4sMC5UbYlDmlzGRDS1o=; b=FFgWeXi/IVEw2Vd/vT9270MVQBelXhdNXWffbYv3ozWt2UqXZQ9/zEWJbnIIDdXUT3 t4FB/OQD/NLvw1olMnKy1saBLUKFtajL1r+Vq5Ogck9OHYE6j7WaoGm6CAAuDJer5leh HoE7kN0UU29rSeAnQcj96tpt1kGr+eKwRo5IwcV0bwS/eFjE08I5riECPXVHZB+WiOPd JmT6NZ8uBk3AM9ksif75/mOB91fXjUMdlQIQ8y0FpKRTuU6+wcWpYq39GO1tNyRHVqkm cYE5ZQeSVTDJDbYxZCORNiyfxKNEOKF7Gg+1DDzRBAAlbjX+ifBhKEU+QjauMy/b4Vtr HqbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=sQN0vEkP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p9si164126oth.91.2020.03.05.14.22.13; Thu, 05 Mar 2020 14:22:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=sQN0vEkP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726504AbgCEWVW (ORCPT + 99 others); Thu, 5 Mar 2020 17:21:22 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:45635 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726111AbgCEWVW (ORCPT ); Thu, 5 Mar 2020 17:21:22 -0500 Received: by mail-qk1-f194.google.com with SMTP id z12so426898qkg.12; Thu, 05 Mar 2020 14:21:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Hjtx1RhxIJ79+HtjekmYaD6b4sMC5UbYlDmlzGRDS1o=; b=sQN0vEkP3aC1hSrFZP7n9s8CPuE2ahPRI4xmxKaklhHA0PgzPO3hoHAxPlCw/E6QAj LJLrjFAzAHGpQa4qWLneFXVGAhy9xmmRsBQYGTgi0ZaoOPF/iBG/v68GL+Gcksb9Bhln jzE/lfzrVzIDqnpC/g9pfgA7TBaaB1iDjxIqpofWxpasTENLg3TLRpN2AKKRiY652TOg 42IaLoNBIQY+hQvcWg3am5RDrCyUWmp+eCtlooyZPY2W6Ae4IHfZfpX+y81a3Q2msCWb T6B2VJfsyi72VL1y39OomY3tM5cUwlwwFFl7LWZ4y5gHB0XPOab6Xb8pdbrBjVMquRbu 6cUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:date:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=Hjtx1RhxIJ79+HtjekmYaD6b4sMC5UbYlDmlzGRDS1o=; b=tlGFm7OsUAVc1V9wUY9+CjDEYRZ/dVtNmaeTR+WNcroeRizKne7DeTeofgc5mYwANu 8vHzgukXA1tnOfBs2k2FqxaO/JJAMmCc0xtseO+derrY0WpwxQ6/iaZg8Ck8j/5h4P3U feHx1RxmaP1wX1v/GjMfYHXr8Hdic9f9XLXoh3idI48J6XGVaXMR4H8G/RTshDZY+5HL 4L9DYwAKhU0n7sCYa+PrkyrJ1xgew9XPSSDrrkhCH91U1wGXc4EryCsFbfsj5cNK8jvh Sazxek2TXH8oev68cMppBrBkr1Vc4O59aBR9kuvWvx0pNhO05rERWWQ9NTWatYF3pxa6 jPUA== X-Gm-Message-State: ANhLgQ345Jo43ywLzbZ+dzn7cAsMzjc0pOANZTg63mqYLq3uENWkXqpJ PM/DoMJkBYp+OAfpUsKeE10= X-Received: by 2002:a05:620a:1186:: with SMTP id b6mr214359qkk.59.1583446881492; Thu, 05 Mar 2020 14:21:21 -0800 (PST) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id d9sm16120639qth.34.2020.03.05.14.21.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Mar 2020 14:21:21 -0800 (PST) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Thu, 5 Mar 2020 17:21:18 -0500 To: James Bottomley Cc: Ignat Korchagin , viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@cloudflare.com Subject: Re: [PATCH] mnt: add support for non-rootfs initramfs Message-ID: <20200305222117.GA1291132@rani.riverdale.lan> References: <20200305193511.28621-1-ignat@cloudflare.com> <1583442550.3927.47.camel@HansenPartnership.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1583442550.3927.47.camel@HansenPartnership.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 05, 2020 at 01:09:10PM -0800, James Bottomley wrote: > On Thu, 2020-03-05 at 19:35 +0000, Ignat Korchagin wrote: > > The main need for this is to support container runtimes on stateless > > Linux system (pivot_root system call from initramfs). > > > > Normally, the task of initramfs is to mount and switch to a "real" > > root filesystem. However, on stateless systems (booting over the > > network) it is just convenient to have your "real" filesystem as > > initramfs from the start. > > > > This, however, breaks different container runtimes, because they > > usually use pivot_root system call after creating their mount > > namespace. But pivot_root does not work from initramfs, because > > initramfs runs form rootfs, which is the root of the mount tree and > > can't be unmounted. > > Can you say more about why this is a problem? We use pivot_root to > pivot from the initramfs rootfs to the newly discovered and mounted > real root ... the same mechanism should work for a container (mount > namespace) running from initramfs ... why doesn't it? Not sure how it interacts with mount namespaces, but we don't use pivot_root to go from rootfs to the real root. We use switch_root, which moves the new root onto the old / using mount with MS_MOVE and then chroot to it. https://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt > > The sequence usually looks like: create and enter a mount namespace, > build a tmpfs for the container in some $root directory then do > > > cd $root > mkdir old-root > pivot_root . old-root > mount -- > make-rprivate /old-root > umount -l /old-root > rmdir /old-root > > Once that's done you're disconnected from the initramfs root. The > sequence is really no accident because it's what the initramfs would > have done to pivot to the new root anyway (that's where container > people got it from). > > > James >