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: <344eb09a0706200156l2d22ac65o49b893aa29b17291@mail.gmail.com>
Date:	Wed, 20 Jun 2007 14:26:52 +0530
From:	"Bharata B Rao" <bharata.rao@...il.com>
To:	"Jan Blunck" <jblunck@...e.de>
Cc:	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [RFC PATCH 3/4] Lookup changes to support union mount.

On 6/20/07, Jan Blunck <jblunck@...e.de> wrote:
> On Wed, 20 Jun 2007 11:23:26 +0530, Bharata B Rao wrote:
>
> > +/*
> > + * Looks for the given @name in dcache by walking through all the layers
> > + * of the union stack, starting from the top.
> > + * FIXME: If we don't find the dentry in a upper layer, we descend to the
> > + * next layer. So there is a chance to miss this dentry in the top layer
> > + * if this is the _first_ time lookup of the dentry in this layer. A real
> > + * lookup might have fetched a valid dentry in this layer itself, while we
> > + * chose to descend to the next lower layer. One solution is not have this
> > + * function itself, do the toplevel lookup in dcache and if it fails proceed
> > + * to real_lookup_union() directly.
> > + */
> > +struct dentry *__d_lookup_union(struct nameidata *nd, struct qstr *name)
> > +{
> > +     struct dentry *dentry;
> > +     struct nameidata nd_tmp;
> > +     struct vfsmount *mnt = mntget(nd->mnt);
> > +     struct qstr this;
> > +     int err;
> > +
> > +     nd_tmp.mnt = nd->mnt;
> > +     nd_tmp.dentry = nd->dentry;
> > +
> > +     this.name = name->name;
> > +     this.len = name->len;
> > +     this.hash = name->hash;
> > +
> > +     do {
> > +             /* d_hash() is a repetition for the top layer. */
> > +             if (nd_tmp.dentry->d_op && nd_tmp.dentry->d_op->d_hash) {
> > +                     err = nd_tmp.dentry->d_op->d_hash(nd_tmp.dentry, &this);
> > +                     if (err < 0)
> > +                             goto out;
> > +             }
> > +
> > +             dentry = __d_lookup(nd_tmp.dentry, &this);
> > +             if (dentry) {
> > +                     if (dentry->d_inode) {
> > +                             if (nd->mnt != nd_tmp.mnt) {
> > +                                     mntput(nd->mnt);
> > +                                     nd->mnt = mntget(nd_tmp.mnt);
> > +                             }
> > +                             mntput(mnt);
> > +                             return dentry;
> > +                     } else {
> > +                             dput(dentry);
> > +                     }
> > +             }
> > +     } while (next_union_mount(&nd_tmp));
> > +out:
> > +     mntput(mnt);
> > +     return NULL;
> > +}
> > +
>
> The reference counting for vfsmount is wrong. next_union_mount() should be
> something similar to follow_down(). You should grab the reference to the
> underlying mount before doing the lookup. Ok ok, you already have a valid
> reference in struct union_mount but anyway.

The idea is that a reference to the top layer's vfsmount and dentry is
taken by the user of the union mount point/directory (eg. lookup,
readdir etc) and that should ensure that all the bottom layers are
valid until the top level reference is held.

Regards,
Bharata.
-- 
"Men come and go but mountains remain" -- Ruskin Bond.
-
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