From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aristeu Rozanski Subject: [PATCH RFC 2/8] ipcns: introduce ipcns_get_inum() Date: Mon, 18 Mar 2013 11:45:41 -0400 Message-ID: <1363621547-25239-3-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/ipc_namespace.h | 1 + ipc/namespace.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h index ae221a7..f9fb114 100644 --- a/include/linux/ipc_namespace.h +++ b/include/linux/ipc_namespace.h @@ -146,6 +146,7 @@ static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) } extern void put_ipc_ns(struct ipc_namespace *ns); +extern unsigned int ipcns_get_inum(struct task_struct *tsk); #else static inline struct ipc_namespace *copy_ipcs(unsigned long flags, struct user_namespace *user_ns, struct ipc_namespace *ns) diff --git a/ipc/namespace.c b/ipc/namespace.c index 7c1fa45..4615db5 100644 --- a/ipc/namespace.c +++ b/ipc/namespace.c @@ -188,6 +188,20 @@ static unsigned int ipcns_inum(void *vp) return ns->proc_inum; } +unsigned int ipcns_get_inum(struct task_struct *tsk) +{ + struct nsproxy *nsproxy; + unsigned int rc = 0; + + rcu_read_lock(); + nsproxy = task_nsproxy(tsk); + if (nsproxy) + rc = ipcns_inum(nsproxy->ipc_ns); + rcu_read_unlock(); + + return rc; +} + const struct proc_ns_operations ipcns_operations = { .name = "ipc", .type = CLONE_NEWIPC, -- 1.7.1