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

Miklos Szeredi
2005-05-13T06:06:44Z

> r u sure, this program works?

Yes :)

> 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.

See 'man 7 unix' SCM_RIGHTS.

How do you know the program did not work?

Note: the program starts a new shell, it doesn't exit! Do this in the
started shell (do not 'cd' before it):

ls tmp/clonetest/mnt
ls /tmp/clonetest/mnt

If you see different things, then the program worked.

It's not such a magic thing. You can also do something similar for
example by:

shell1> mount --bind / /tmp/mnt
shell1> cd /tmp/mnt
sheel2> umount -l /tmp/mnt

Now shell1 sees two separate "namespaces" in in CWD and /

Miklos