[PATCH RFC 4/8] userns: introduce userns_get_inum()

Aristeu Rozanski arozansk at redhat.com
Mon Mar 18 15:45:43 UTC 2013


This allows other parts of the kernel to have access to userspace
visible namespace identification.

Signed-off-by: Aristeu Rozanski <arozansk at redhat.com>
---
 include/linux/user_namespace.h |    1 +
 kernel/user_namespace.c        |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index 4ce0093..520d8b2 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -56,6 +56,7 @@ extern struct seq_operations proc_projid_seq_operations;
 extern ssize_t proc_uid_map_write(struct file *, const char __user *, size_t, loff_t *);
 extern ssize_t proc_gid_map_write(struct file *, const char __user *, size_t, loff_t *);
 extern ssize_t proc_projid_map_write(struct file *, const char __user *, size_t, loff_t *);
+extern unsigned int userns_get_inum(struct task_struct *tsk);
 #else
 
 static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index 8b65083..9a0db6d 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -856,6 +856,11 @@ static unsigned int userns_inum(void *ns)
 	return user_ns->proc_inum;
 }
 
+unsigned int userns_get_inum(struct task_struct *tsk)
+{
+	return userns_inum(task_cred_xxx(tsk, user_ns));
+}
+
 const struct proc_ns_operations userns_operations = {
 	.name		= "user",
 	.type		= CLONE_NEWUSER,
-- 
1.7.1




More information about the Linux-audit mailing list