From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aristeu Rozanski Subject: [PATCH RFC 4/8] userns: introduce userns_get_inum() Date: Mon, 18 Mar 2013 11:45:43 -0400 Message-ID: <1363621547-25239-5-git-send-email-arozansk@redhat.com> References: <1363621547-25239-1-git-send-email-arozansk@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1363621547-25239-1-git-send-email-arozansk@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com To: linux-audit@redhat.com List-Id: linux-audit@redhat.com This allows other parts of the kernel to have access to userspace visible namespace identification. Signed-off-by: Aristeu Rozanski --- 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