lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121129205334.GR4939@ZenIV.linux.org.uk>
Date:	Thu, 29 Nov 2012 20:53:34 +0000
From:	Al Viro <viro@...IV.linux.org.uk>
To:	"Eric W. Biederman" <ebiederm@...ssion.com>
Cc:	Maarten Lankhorst <maarten.lankhorst@...onical.com>,
	linux-fsdevel@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] Revert "__d_unalias() should refuse to move mountpoints"

On Thu, Nov 29, 2012 at 08:06:12PM +0000, Al Viro wrote:
> On Tue, Sep 25, 2012 at 04:29:58AM -0700, Eric W. Biederman wrote:
> > Maarten Lankhorst <maarten.lankhorst@...onical.com> writes:
> > 
> > >> Could you try the following patch?  This should report what directories
> > >> cannot be renamed because one of them is a mount point and it gives some
> > >> real insight into what is going on.
> > >
> > > ls /
> > > __d_unalias: /dev -> /dev
> > > __d_unalias: /proc -> /proc
> > > __d_unalias: /sys -> /sys
> > 
> > Ok.  That is what I thought was going on.  For some reason nfs is
> > attempting to recreate an existing dentry.
> > 
> > Does this fix the nfs problem for you?
> > 
> > Eric
> > 
> > diff --git a/fs/dcache.c b/fs/dcache.c
> > index 8086636..6390f0f 100644
> > --- a/fs/dcache.c
> > +++ b/fs/dcache.c
> > @@ -2404,6 +2404,9 @@ out_unalias:
> >  	if (likely(!d_mountpoint(alias))) {
> >  		__d_move(alias, dentry);
> >  		ret = alias;
> > +	} else if ((alias->d_parent == dentry->d_parent) &&
> > +		   !dentry_cmp(alias, dentry->d_name.name, dentry->d_name.len))
> > +		ret = alias;
> >  	}
> 
> The interesting question is why the hell had it decided that preexisting
> dentry was not good enough for it?  Note that we have arrived to nfs_lookup()
> after we'd decided *not* to use the damn alias.  The trace posted upthread
> went __lookup_hash() -> lookup_real().  It means that lookup_dcache()
> has not produced this one.  And no, even if ->d_revalidate() decided it
> was no good, the logics in d_invalidate() would've said "busy" and we'd
> gone with that dentry anyway.  So it means that d_lookup() has not
> found it at all.
> 
> IOW, something out there is blindly unhashing mountpoint dentries; that's
> where the real root of the problem seems to be.  Could you slap
> WARN_ON(d_mountpoint(dentry)) in __d_drop() and see what it catches?

Ho-hum...  nfs_prime_dcache() seems to be the likely suspect.  What happens
if we get nfs_same_file() failing for some reason for a mountpoint there?
Or for a busy directory, for that matter...

Guys, could somebody with reproducer see if we step into the else side of
                if (nfs_same_file(dentry, entry)) {
                        nfs_refresh_inode(dentry->d_inode, entry->fattr);
                        goto out;
                } else {
                        d_drop(dentry);
                        dput(dentry);
                }
in nfs_prime_dcache() with dentry being a mountpoint?  If nothing else,
I would suggest replacing that d_drop(dentry) with
	if (d_invalidate(dentry) != 0)
		goto out;
in there.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ