CLONE_NEWNS flaw
Hi Al,
Now that hch mentioned CLONE_NEWNS I looked at the code to see how things are today. But in 2.5.44 it is still broken. One thing that is wrong is that when you copy namespaces, the order is reversed, but you depend on the order for assigning root, altroot and cwd. Thus, after using CLONE_NEWNS these, and in particular cwd, will be random and probably incorrect.
Maybe something like
namespace.c Mon Oct 28 22:50:10 2002 renamed from namespace.c~ Mon Oct 28 21:25:08 2002 +1 -1
@@ -110,7 +110,7 @@ mnt->mnt_parent = mntget(nd->mnt); mnt->mnt_mountpoint = dget(nd->dentry); list_add(&mnt->mnt_hash, mount_hashtable+hash(nd->mnt, nd->dentry)); - list_add(&mnt->mnt_child, &nd->mnt->mnt_mounts); + list_add_tail(&mnt->mnt_child, &nd->mnt->mnt_mounts); nd->dentry->d_mounted++; }
is good enough to repair, but I have not checked all callers of attach_mnt().
Andries