Re: [PATCH v2 00/12] make rpc_pipefs be mountable multiple time

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Kirill A. Shutemov
Date: Friday, December 31, 2010 - 6:03 am

On Thu, Dec 30, 2010 at 06:52:43AM -0600, Rob Landley wrote:

/var/lib/net/rpc_pipefs is default path where userspace part of NFS stack
(gssd, idmapd) want to see rpc_pipefs


Root namespace is special. In case of nfsroot you need rpc_pipefs before
root available.


It breaks isolation. Container should not use host's rpc_pipefs without
host's permission.
 

static int check_rpc_pipefs(struct vfsmount *mnt, void *arg)
{
        struct vfsmount **rpcmount = arg;
        struct path path = {
                .mnt = mnt,
                .dentry = mnt->mnt_root,
        };

        if (!mnt->mnt_sb)
                return 0;
        if (mnt->mnt_sb->s_magic != RPCAUTH_GSSMAGIC)
                return 0;

        if (!path_is_under(&path, &current->fs->root))
                return 0;

        *rpcmount = mntget(mnt);
        return 1;
}

struct vfsmount *get_rpc_pipefs(const char *p)
{
        int error;
        struct vfsmount *rpcmount = ERR_PTR(-EINVAL);
        struct path path;

        if (!p) {
                iterate_mounts(check_rpc_pipefs, &rpcmount,
                                current->nsproxy->mnt_ns->root);

                if (IS_ERR(rpcmount) && (current->nsproxy->mnt_ns ==
                                        init_task.nsproxy->mnt_ns))
                        return mntget(init_rpc_pipefs);

                return rpcmount;
        }

        error = kern_path(p, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path);
        if (error)
                return ERR_PTR(error);

        check_rpc_pipefs(path.mnt, &rpcmount);
        path_put(&path);

        return rpcmount;
}
EXPORT_SYMBOL_GPL(get_rpc_pipefs);

Something like this? Patch to replace patch #10 attached.

-- 
 Kirill A. Shutemov
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH v2 00/12] make rpc_pipefs be mountable multiple time, Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 01/12] sunrpc: mount rpc_pipefs on initialization, Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 03/12] sunrpc: push init_rpc_pipefs up to rpc_cr ..., Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 05/12] sunrpc: get rpc_pipefs mount point for sv ..., Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 06/12] lockd: get rpc_pipefs mount point from ca ..., Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 07/12] sunrpc: get rpc_pipefs mount point for rp ..., Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 08/12] sunrpc: tag pipefs field of cache_detail ..., Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 09/12] nfs: per-rpc_pipefs dns cache, Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 10/12] sunrpc: introduce get_rpc_pipefs(), Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 11/12] nfs: introduce mount option 'rpcmount', Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
[PATCH v2 12/12] sunrpc: make rpc_pipefs be mountable mult ..., Kirill A. Shutemov, (Wed Dec 29, 6:14 am)
Re: [PATCH v2 00/12] make rpc_pipefs be mountable multiple ..., Kirill A. Shutemov, (Thu Dec 30, 1:51 am)
Re: [PATCH v2 00/12] make rpc_pipefs be mountable multiple ..., Kirill A. Shutemov, (Thu Dec 30, 2:44 am)
Re: [PATCH v2 00/12] make rpc_pipefs be mountable multiple ..., Kirill A. Shutemov, (Thu Dec 30, 3:44 am)
Re: [PATCH v2 00/12] make rpc_pipefs be mountable multiple ..., Kirill A. Shutemov, (Thu Dec 30, 4:45 am)
Re: [PATCH v2 00/12] make rpc_pipefs be mountable multiple ..., Kirill A. Shutemov, (Fri Dec 31, 6:03 am)
Re: [PATCH v2 00/12] make rpc_pipefs be mountable multiple ..., Kirill A. Shutemov, (Mon Jan 3, 9:53 am)