This allows other parts of the kernel to have access to userspace visible namespace identification.
Signed-off-by: Aristeu Rozanski <[email protected]> --- 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 -- Linux-audit mailing list [email protected] https://www.redhat.com/mailman/listinfo/linux-audit
