We should use the proper user namespace to filter the syscall.

Signed-off-by: Gao feng <[email protected]>
---
 kernel/auditsc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 29c3e05..5401d21 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -866,14 +866,15 @@ static enum audit_state audit_filter_task(struct 
task_struct *tsk, char **key)
  * also not high enough that we already know we have to write an audit
  * record (i.e., the state is AUDIT_SETUP_CONTEXT or AUDIT_BUILD_CONTEXT).
  */
-static enum audit_state audit_filter_syscall(struct task_struct *tsk,
+static enum audit_state audit_filter_syscall(struct user_namespace *ns,
+                                            struct task_struct *tsk,
                                             struct audit_context *ctx,
                                             struct list_head *list)
 {
        struct audit_entry *e;
        enum audit_state state;
 
-       if (init_user_ns.audit.pid && tsk->tgid == init_user_ns.audit.pid)
+       if (ns->audit.pid && tsk->tgid == ns->audit.pid)
                return AUDIT_DISABLED;
 
        rcu_read_lock();
@@ -976,7 +977,7 @@ static inline struct audit_context 
*audit_get_context(struct task_struct *tsk,
                context->return_code  = return_code;
 
        if (context->in_syscall && !context->dummy) {
-               audit_filter_syscall(tsk, context,
+               audit_filter_syscall(ns, tsk, context,
                                &ns->audit.filter_list[AUDIT_FILTER_EXIT]);
                audit_filter_inodes(tsk, context);
        }
@@ -1784,7 +1785,7 @@ void __audit_syscall_entry(int arch, int major,
        context->dummy = !audit_n_rules;
        if (!context->dummy && state == AUDIT_BUILD_CONTEXT) {
                context->prio = 0;
-               state = audit_filter_syscall(tsk, context,
+               state = audit_filter_syscall(ns, tsk, context,
                        &ns->audit.filter_list[AUDIT_FILTER_ENTRY]);
        }
        if (state == AUDIT_DISABLED)
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to