From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aristeu Rozanski Subject: [PATCH RFC 1/8] mntns: introduce mntns_get_inum() Date: Mon, 18 Mar 2013 11:45:40 -0400 Message-ID: <1363621547-25239-2-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 --- fs/namespace.c | 14 ++++++++++++++ include/linux/mnt_namespace.h | 2 ++ 2 files changed, 16 insertions(+), 0 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index 50ca17d..b8a888f 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2792,6 +2792,20 @@ static unsigned int mntns_inum(void *ns) return mnt_ns->proc_inum; } +unsigned int mntns_get_inum(struct task_struct *tsk) +{ + struct nsproxy *nsproxy; + int rc = 0; + + rcu_read_lock(); + nsproxy = task_nsproxy(tsk); + if (nsproxy) + rc = mntns_inum(nsproxy->mnt_ns); + rcu_read_unlock(); + + return rc; +} + const struct proc_ns_operations mntns_operations = { .name = "mnt", .type = CLONE_NEWNS, diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h index 12b2ab5..b6afe65 100644 --- a/include/linux/mnt_namespace.h +++ b/include/linux/mnt_namespace.h @@ -5,10 +5,12 @@ struct mnt_namespace; struct fs_struct; struct user_namespace; +struct task_struct; extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, struct user_namespace *, struct fs_struct *); extern void put_mnt_ns(struct mnt_namespace *ns); +extern unsigned int mntns_get_inum(struct task_struct *tsk); extern const struct file_operations proc_mounts_operations; extern const struct file_operations proc_mountinfo_operations; -- 1.7.1