From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f67.google.com ([209.85.128.67]:37736 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726537AbeJKTuh (ORCPT ); Thu, 11 Oct 2018 15:50:37 -0400 Subject: Re: [PATCH 03/34] teach move_mount(2) to work with OPEN_TREE_CLONE [ver #12] To: David Howells , viro@zeniv.linux.org.uk Cc: torvalds@linux-foundation.org, ebiederm@xmission.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, mszeredi@redhat.com References: <16207.1539249451@warthog.procyon.org.uk> <5c6f3d62-4cec-2aea-4693-62928611c526@gmail.com> <153754740781.17872.7869536526927736855.stgit@warthog.procyon.org.uk> <153754743491.17872.12115848333103740766.stgit@warthog.procyon.org.uk> <862e36a2-2a6f-4e26-3228-8cab4b4cf230@gmail.com> <6533.1539260096@warthog.procyon.org.uk> From: Alan Jenkins Message-ID: <92bfc752-100b-619d-f1c9-b1ea93244ab4@gmail.com> Date: Thu, 11 Oct 2018 13:23:35 +0100 MIME-Version: 1.0 In-Reply-To: <6533.1539260096@warthog.procyon.org.uk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 11/10/2018 13:14, David Howells wrote: > David Howells wrote: > >> The reason that you can do this with open_tree()/move_mount() is that it >> allows you to create a mount tree (OPEN_TREE_CLONE) that has no namespace >> assignment, pass it through the namespace switch and then attach it inside the >> child namespace. The cross-namespace checks in do_move_mount() are bypassed >> because the root of the newly-cloned mount tree doesn't have one. > It's worse than that. The apparently disconnected tree given you by > open_tree(OPEN_TREE_CLONE) is still subject to modification by outside > forces. All it takes is one shared object within that tree. > > So I do wonder if it's possible to form a ring, even in an upstream kernel, by > using the propagation mechanism to push through an nsfs mount into itself, > possibly with a layer of indirection (ie. having two mutually-referential > namespaces). > > David Upstream does cover the mount propagation case, by simply never propagating mounts of mount NS files.  See commit 4ce5d2b1a8fd "vfs: Don't copy mount bind mounts of /proc//ns/mnt between namespaces" / https://unix.stackexchange.com/questions/473717/what-code-prevents-mount-namespace-loops-in-a-more-complex-case-involving-mount-propagation