aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2010-03-07 18:49:36 -0800
committerZiyan <jaraidaniel@gmail.com>2016-03-11 16:08:56 +0100
commitf7b3253596c1e350379b3b1c833fa44cbcf28dd7 (patch)
tree512556a9b527237669a2ed3535b73524a3a9d108 /fs/proc
parent9cd34ebb3ab309a71cb460fa079b820c44111d0d (diff)
downloadkernel_samsung_espresso10-f7b3253596c1e350379b3b1c833fa44cbcf28dd7.zip
kernel_samsung_espresso10-f7b3253596c1e350379b3b1c833fa44cbcf28dd7.tar.gz
kernel_samsung_espresso10-f7b3253596c1e350379b3b1c833fa44cbcf28dd7.tar.bz2
vfs: Add setns support for the mount namespace
setns support for the mount namespace is a little tricky as an arbitrary decision must be made about what to set fs->root and fs->pwd to, as there is no expectation of a relationship between the two mount namespaces. Therefore I arbitrarily find the root mount point, and follow every mount on top of it to find the top of the mount stack. Then I set fs->root and fs->pwd to that location. The topmost root of the mount stack seems like a reasonable place to be. Bind mount support for the mount namespace inodes has the possibility of creating circular dependencies between mount namespaces. Circular dependencies can result in loops that prevent mount namespaces from every being freed. I avoid creating those circular dependencies by adding a sequence number to the mount namespace and require all bind mounts be of a younger mount namespace into an older mount namespace. Add a helper function proc_ns_inode so it is possible to detect when we are attempting to bind mound a namespace inode. Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> (cherry picked from commit 8823c079ba7136dc1948d6f6dcb5f8022bde438e) Conflicts: fs/namespace.c
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/namespaces.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c
index d6c078e..7668a61 100644
--- a/fs/proc/namespaces.c
+++ b/fs/proc/namespaces.c
@@ -25,6 +25,10 @@ static const struct proc_ns_operations *ns_entries[] = {
#ifdef CONFIG_IPC_NS
&ipcns_operations,
#endif
+#ifdef CONFIG_PID_NS
+ &pidns_operations,
+#endif
+ &mntns_operations,
};
static const struct file_operations ns_file_operations = {
@@ -199,3 +203,7 @@ out_invalid:
return ERR_PTR(-EINVAL);
}
+bool proc_ns_inode(struct inode *inode)
+{
+ return inode->i_fop == &ns_file_operations;
+}