Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757427AbbDVUMo (ORCPT ); Wed, 22 Apr 2015 16:12:44 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:45027 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752141AbbDVUMm (ORCPT ); Wed, 22 Apr 2015 16:12:42 -0400 Date: Wed, 22 Apr 2015 21:12:38 +0100 From: Al Viro To: NeilBrown Cc: Christoph Hellwig , Linus Torvalds , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [RFC][PATCHSET] non-recursive link_path_walk() and reducing stack footprint Message-ID: <20150422201238.GW889@ZenIV.linux.org.uk> References: <20150420181222.GK889@ZenIV.linux.org.uk> <20150421144959.GR889@ZenIV.linux.org.uk> <20150421150408.GA29838@infradead.org> <553668C1.8030707@nod.at> <20150421154504.GT889@ZenIV.linux.org.uk> <20150421212007.GU889@ZenIV.linux.org.uk> <20150422180702.GA15209@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150422180702.GA15209@ZenIV.linux.org.uk> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1498 Lines: 28 On Wed, Apr 22, 2015 at 07:07:59PM +0100, Al Viro wrote: > And one more: may_follow_link() is now potentially oopsable. Look: suppose > we've reached the link in RCU mode, just as it got unlinked. link->dentry > has become negative and may_follow_link() steps into > /* Allowed if owner and follower match. */ > inode = link->dentry->d_inode; > if (uid_eq(current_cred()->fsuid, inode->i_uid)) > return 0; > Oops... Incidentally, I suspect that your __read_seqcount_retry() in > follow_link() might be lacking a barrier; why isn't full read_seqcount_retry() > needed? > > FWIW, I would rather fetch ->d_inode *and* checked ->seq proir to calling > get_link(), and passed inode to it as an explicit argument. And passed it > to may_follow_link() as well... Hrm... You know, something really weird is going on here. Where are you setting nd->seq? I don't see anything in follow_link() doing that. And nd->seq _definitely_ needs setting if you want to stay in RCU mode - at that point it matches the dentry of symlink, not that of nd->path (== parent directory). Neil, could you tell me which kernel you'd been testing (ideally - commit ID is a public git tree), what config and what tests had those been? -- 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/