From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman) Subject: Re: [REVIEW][PATCH 1/4] vfs: Don't allow overwriting mounts in the current mount namespace Date: Thu, 21 Nov 2013 12:58:44 -0800 Message-ID: <878uwh8oaj.fsf@xmission.com> References: <87vc15mjuw.fsf@xmission.com> <87iox38fkv.fsf@xmission.com> <87d2nb8dxy.fsf@xmission.com> <87iowyxpci.fsf_-_@xmission.com> <87d2n6xpan.fsf_-_@xmission.com> <20131103035406.GA8537@ZenIV.linux.org.uk> <87bo1u8vmf.fsf@xmission.com> <20131108213551.GR13318@ZenIV.linux.org.uk> <87fvr61qtg.fsf@xmission.com> <20131109084916.GA21413@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20131109084916.GA21413-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org> (Christoph Hellwig's message of "Sat, 9 Nov 2013 00:49:16 -0800") List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Christoph Hellwig Cc: Miklos Szeredi , Linux Containers , Kernel Mailing List , Andy Lutomirski , Al Viro , Linux-Fsdevel , Matthias Schniedermeyer , Linus Torvalds List-Id: containers.vger.kernel.org Christoph Hellwig writes: > On Fri, Nov 08, 2013 at 02:17:31PM -0800, Eric W. Biederman wrote: >> > Read what you've written a few lines above. The part about target->i_mutex >> > being held. >> >> That works for the rename as unlink case but we don't hold >> old_dentry->d_inode->i_mutex which is what is needed to prevent a mount >> on the dentry we are renaming. > > It will be held in 3.13. Only for files, not for directories. And none of those locks turns out to be good enough today to prevent the races between mount and rename. With the result that when mount returns your mount point could be located just about anywhere, and that is just considering renames of the actual mountpoint itself. Eric