From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aristeu Rozanski Subject: [PATCH RFC 3/8] pidns: introduce pidns_get_inum() Date: Mon, 18 Mar 2013 11:45:42 -0400 Message-ID: <1363621547-25239-4-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/pid_namespace.h | 1 + kernel/pid_namespace.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h index 215e5e3..8223654 100644 --- a/include/linux/pid_namespace.h +++ b/include/linux/pid_namespace.h @@ -57,6 +57,7 @@ extern struct pid_namespace *copy_pid_ns(unsigned long flags, extern void zap_pid_ns_processes(struct pid_namespace *pid_ns); extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd); extern void put_pid_ns(struct pid_namespace *ns); +extern unsigned int pidns_get_inum(struct task_struct *tsk); #else /* !CONFIG_PID_NS */ #include diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index c1c3dc1..5e463ff 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c @@ -361,6 +361,17 @@ static unsigned int pidns_inum(void *ns) return pid_ns->proc_inum; } +unsigned int pidns_get_inum(struct task_struct *tsk) +{ + unsigned int rc; + + rcu_read_lock(); + rc = pidns_inum(task_active_pid_ns(tsk)); + rcu_read_unlock(); + + return rc; +} + const struct proc_ns_operations pidns_operations = { .name = "pid", .type = CLONE_NEWPID, -- 1.7.1