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

From: Miklos Szeredi
Date: Fri May 13 2005 - 01:08:15 EST


> 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/