Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755349AbaJGVwo (ORCPT ); Tue, 7 Oct 2014 17:52:44 -0400 Received: from mail-la0-f53.google.com ([209.85.215.53]:47165 "EHLO mail-la0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755134AbaJGVwm (ORCPT ); Tue, 7 Oct 2014 17:52:42 -0400 MIME-Version: 1.0 In-Reply-To: <87zjd7pn0o.fsf@x220.int.ebiederm.org> References: <1412683977-29543-1-git-send-email-avagin@openvz.org> <20141007133039.GG7996@ZenIV.linux.org.uk> <20141007133339.GH7996@ZenIV.linux.org.uk> <87r3yjy64e.fsf@x220.int.ebiederm.org> <87siizshav.fsf@x220.int.ebiederm.org> <87zjd7pn0o.fsf@x220.int.ebiederm.org> From: Andy Lutomirski Date: Tue, 7 Oct 2014 14:52:21 -0700 Message-ID: Subject: Re: [PATCH] [RFC] mnt: add ability to clone mntns starting with the current root To: "Eric W. Biederman" Cc: Al Viro , Andrey Vagin , Linux FS Devel , "linux-kernel@vger.kernel.org" , Linux API , Andrey Vagin , Andrew Morton , Cyrill Gorcunov , Pavel Emelyanov , Serge Hallyn , Rob Landley Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 7, 2014 at 2:50 PM, Eric W. Biederman wrote: > Andy Lutomirski writes: > >> On Tue, Oct 7, 2014 at 2:26 PM, Eric W. Biederman wrote: >>> Andy Lutomirski writes: >>> >>>> Why should MNT_LOCKED on submounts be enforced? >>>> >>>> Is it because, if you retain a reference to the detached tree, then >>>> you can see under the submounts? >>> >>> Yes. MNT_DETACH is a recursive operation that detaches all of the mount >>> and all of it's submounts. Which means you can see under the submounts >>> if you have a reference to a detached mount. >>> >>>> If so, let's fix *that*. Because >>>> otherwise the whole model of pivot_root + detach will break. >>> >>> I am not certain what you are referring to. pivot_root doesn't >>> manipulate the mount tree so you can see under anything. >>> >>> What I believe is the appropriate fix is to fail umount2(...,MNT_DETACH) >>> if there are any referenced mount points being detached that have a >>> locked submount. >> >> Most of the container-using things do, roughly: >> >> Unshare userns and mountns >> Mount some new stuff >> pivot_root to the new stuff >> MNT_DETACH the old. >> >> That last step will almost always fail if you make this change. > > I don't think so. > > I expect I could add full busy detection of normal umounts and those > applications would not fail. > > What I am proposing is a more targeted version of busy detection that > looks at each mount in the set that detach will unmount. For each mount > if it is busy with non-submount references and it has at least one > locked submount fail the detach with -EBUSY. > > Do you really think we have userspace references to the one or more of the > mounts under old? > I suspect that we have a userspace reference to old itself. --Andy > Eric -- Andy Lutomirski AMA Capital Management, LLC -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/