[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170217022918.GC29622@ZenIV.linux.org.uk>
Date: Fri, 17 Feb 2017 02:29:18 +0000
From: Al Viro <viro@...IV.linux.org.uk>
To: James Bottomley <James.Bottomley@...senPartnership.com>
Cc: Djalal Harouni <tixxdz@...il.com>, Chris Mason <clm@...com>,
Theodore Tso <tytso@....edu>,
Josh Triplett <josh@...htriplett.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Andy Lutomirski <luto@...nel.org>,
Seth Forshee <seth.forshee@...onical.com>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org,
Dongsu Park <dongsu@...ocode.com>,
David Herrmann <dh.herrmann@...glemail.com>,
Miklos Szeredi <mszeredi@...hat.com>,
Alban Crequy <alban.crequy@...il.com>,
"Serge E. Hallyn" <serge@...lyn.com>, Phil Estes <estesp@...il.com>
Subject: Re: [RFC 1/1] shiftfs: uid/gid shifting bind mount
On Sat, Feb 04, 2017 at 11:19:32AM -0800, James Bottomley wrote:
> +static const struct dentry_operations shiftfs_dentry_ops = {
> + .d_release = shiftfs_d_release,
> + .d_real = shiftfs_d_real,
> +};
In other words, those dentries are *never* revalidated. Nevermind that
underlying fs might be mounted elsewhere and be actively modified under
you.
> +static struct dentry *shiftfs_lookup(struct inode *dir, struct dentry *dentry,
> + unsigned int flags)
> +{
> + struct dentry *real = dir->i_private, *new;
> + struct inode *reali = real->d_inode, *newi;
> + const struct cred *oldcred, *newcred;
> +
> + inode_lock(reali);
> + oldcred = shiftfs_new_creds(&newcred, dentry->d_sb);
> + new = lookup_one_len(dentry->d_name.name, real, dentry->d_name.len);
> + shiftfs_old_creds(oldcred, &newcred);
> + inode_unlock(reali);
> +
> + if (IS_ERR(new))
> + return new;
> +
> + dentry->d_fsdata = new;
> +
> + if (!new->d_inode)
> + return NULL;
What happens when somebody comes along and creates the damn thing on the
underlying fs? _Not_ via your code, that is - using the underlying fs
mounted elsewhere.
Powered by blists - more mailing lists