Commit f7056d64 authored by David Woodhouse's avatar David Woodhouse

AUDIT: Really exempt auditd from having its actions audited.

We were only avoiding it on syscall exit before; now stop _everything_.
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent d6e0e158
...@@ -477,6 +477,9 @@ static enum audit_state audit_filter_syscall(struct task_struct *tsk, ...@@ -477,6 +477,9 @@ static enum audit_state audit_filter_syscall(struct task_struct *tsk,
int word = AUDIT_WORD(ctx->major); int word = AUDIT_WORD(ctx->major);
int bit = AUDIT_BIT(ctx->major); int bit = AUDIT_BIT(ctx->major);
if (audit_pid && ctx->pid == audit_pid)
return AUDIT_DISABLED;
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(e, list, list) { list_for_each_entry_rcu(e, list, list) {
if ((e->rule.mask[word] & bit) == bit if ((e->rule.mask[word] & bit) == bit
...@@ -494,6 +497,9 @@ int audit_filter_user(struct task_struct *tsk, int type) ...@@ -494,6 +497,9 @@ int audit_filter_user(struct task_struct *tsk, int type)
struct audit_entry *e; struct audit_entry *e;
enum audit_state state; enum audit_state state;
if (audit_pid && tsk->pid == audit_pid)
return AUDIT_DISABLED;
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_USER], list) { list_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_USER], list) {
if (audit_filter_rules(tsk, &e->rule, NULL, &state)) { if (audit_filter_rules(tsk, &e->rule, NULL, &state)) {
...@@ -816,7 +822,7 @@ void audit_free(struct task_struct *tsk) ...@@ -816,7 +822,7 @@ void audit_free(struct task_struct *tsk)
/* Check for system calls that do not go through the exit /* Check for system calls that do not go through the exit
* function (e.g., exit_group), then free context block. */ * function (e.g., exit_group), then free context block. */
if (context->in_syscall && context->auditable && context->pid != audit_pid) if (context->in_syscall && context->auditable)
audit_log_exit(context); audit_log_exit(context);
audit_free_context(context); audit_free_context(context);
...@@ -921,7 +927,7 @@ void audit_syscall_exit(struct task_struct *tsk, int valid, long return_code) ...@@ -921,7 +927,7 @@ void audit_syscall_exit(struct task_struct *tsk, int valid, long return_code)
if (likely(!context)) if (likely(!context))
return; return;
if (context->in_syscall && context->auditable && context->pid != audit_pid) if (context->in_syscall && context->auditable)
audit_log_exit(context); audit_log_exit(context);
context->in_syscall = 0; context->in_syscall = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment