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

Ram
2005-05-13T07:27:52Z

On Thu, 2005-05-12 at 18:10, Ram wrote:
> On Thu, 2005-05-12 at 11:51, Miklos Szeredi wrote:
> > > > I'm not sure passing directory file descriptors is the right semantic
> > > > we want - but at least it provides a point of explicit control (in
> > > > much the same way as a bind). Are you sure the clone + open("/") +
> > > > pass-to-parent scenario you allows the parent to traverse the child's
> > > > private name space through that fd?
> > >
> > > Pretty sure.
> >
> > Yup. Attached a little program that can be used to try this out. It
> > creates a new namespace in the child, does a bind mount (so the
> > namespaces can be differentiated), then sends the file descriptor of
> > "/" to the parent. The parent does fchdir(fd), then starts a shell.
>
>
> > So the result is that CWD is under the child namespace, while root is
> > under the initial namespace.
> >
>
> r u sure, this program works? Sorry if I am saying something dumb here.
> Correct me. When a file descriptor is sent from one process to other,
> arn't they referring to different files in each of the processes.
> fd=5 may be pointing to file 'xyz' in parent process,
> where as fd=5 will be pointing to 'abc' in the child process.
>
> This program did not work for me, and I was wondering if adding
> CLONE_FILES in clone() would help. Because that would make sure
> that both
> the processes share the same file descriptor. It did not work too.
>
> What am I understanding wrong?

Sorry it works. I was misinterpreting the results.

>
> In any case my opinion is if this program works than the hole should
> be closed instead of exploting it to access different namespace. I
> know Jamie is going to pounce at me. ;)

a patch is due to fix the problem :)

RP