Messages in this thread | | | Subject | CLONE_NEWNS & chroot(2) behavior | From | Enrico Scholz <> | Date | Thu, 02 Oct 2003 00:24:05 +0200 |
| |
Hello,
I have problems to understand the CLONE_NEWNS semantic because I see some strange behavior in combination with chroot(2).
E.g. look at the program at
http://www.tu-chemnitz.de/~ensc/nst.c
There, the umount(2) in 'child()' fails when the chroot is outside /dev/root. E.g. when /var/tmp is on a separate partition, I get
# mkdir -p /var/tmp/foo/bar && strace -f ./nst /var/tmp/foo bar | mount("none", "/var/tmp/foo/bar", "proc", , 0) = 0 | chroot("/var/tmp/foo") = 0 | chdir("/") = 0 | clone(Process 28706 attached | child_stack=0xbffff7bc, flags=CLONE_NEWNS|SIGCHLD) = 28706 | [pid 28706] --- SIGSTOP (Stopped (signal)) @ 0 (0) --- | [pid 28706] oldumount("bar") = -1 EINVAL (Invalid argument)
The umount(2) can be replaced with anything which accesses files in "bar"---it would fail too, since "bar" is not mounted in the new namespace.
But when doing the same in /, things are ok:
# mkdir -p /foo/bar && strace -f ./nst /foo bar | mount("none", "/foo/bar", "proc", , 0) = 0 | chroot("/foo") = 0 | chdir("/") = 0 | clone(Process 28733 attached | child_stack=0xbffff7cc, flags=CLONE_NEWNS|SIGCHLD) = 28733 | [pid 28733] --- SIGSTOP (Stopped (signal)) @ 0 (0) --- | [pid 28733] oldumount("bar") = 0
When this behavior is wanted, what is the formal description of the CLONE_NEWNS behavior?
Enrico - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |