From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman) Subject: Re: [PATCH review 5/6] vfs: Test for and handle paths that are unreachable from their mnt_root Date: Mon, 10 Aug 2015 14:34:41 -0500 Message-ID: <871tfbj5ta.fsf@x220.int.ebiederm.org> References: <871tncuaf6.fsf@x220.int.ebiederm.org> <87mw5xq7lt.fsf@x220.int.ebiederm.org> <87a8yqou41.fsf_-_@x220.int.ebiederm.org> <874moq9oyb.fsf_-_@x220.int.ebiederm.org> <871tfkawu9.fsf_-_@x220.int.ebiederm.org> <878u9s9i1d.fsf_-_@x220.int.ebiederm.org> <20150810043814.GD14139@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Andrey Vagin , Miklos Szeredi , Richard Weinberger , Linux Containers , Andy Lutomirski , "J. Bruce Fields" , linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Jann Horn , Linus Torvalds , Willy Tarreau To: Al Viro Return-path: In-Reply-To: <20150810043814.GD14139-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org> (Al Viro's message of "Mon, 10 Aug 2015 05:38:14 +0100") 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 List-Id: linux-fsdevel.vger.kernel.org Al Viro writes: > On Mon, Aug 03, 2015 at 04:30:22PM -0500, Eric W. Biederman wrote: > >> + if (!is_subdir(nd->path.dentry, mnt->mnt_root)) >> + return false; > > Umm... What's to protect us from racing with d_move() right here? is_subdir does the read_seqretry on rename_lock. Which is enough to ensure connectivity exists at a single moment in time. Beyond that the entire path lookup races with d_move, and the code calls path_connected just after finding the parent directory, which ensures that in the moment that follow_dotdot is setting nd->dentry that the original nd->dentry is connected, and by extension the new as the new one is an ancestor. Or are you thinking of a different race? Eric