Re: [RCF] [PATCH] unprivileged mount/umount

Miklos Szeredi
2005-05-13T17:15:26Z

> > > dentry = file->f_dentry;
> > > mnt = file->f_vfsmnt;
> > > inode = dentry->d_inode;
> > > + if(mnt->mnt_namespace != current->namespace)
> > > + goto out_putf;
> > >
> > > error = -ENOTDIR;
> > > if (!S_ISDIR(inode->i_mode))
> > >
> >
> > Does this actually fix the problem? The open is done in the right
> > namespace, and mount() doesn't call open().
>
> Right but this fix disallows fchdir into a directory belonging to
> a different namespace. And hence would disallow the ability to
> cross mount across namespaces.

Ahh, sorry. I thought that check was in open(), but I see now it's in
fchdir(). Next time please use '-p' option of diff, to avoid
confusing thoughtless readers like me :)

Though your patch does fix the bug, I still think it's wrong, since
mounting from a different namespace has legitimate uses, and is not a
security problem.

Miklos