aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/auditsc.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-06-22 09:56:47 -0400
committerDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-06-22 09:56:47 -0400
commit4a4cd633b575609b741a1de7837223a2d9e1c34c (patch)
treef4c3a6beb6a587598193053240f3e3f82885f1e3 /kernel/auditsc.c
parentf6a789d19858a951e7ff9e297a44b377c21b6c33 (diff)
AUDIT: Optimise the audit-disabled case for discarding user messages
Also exempt USER_AVC message from being discarded to preserve existing behaviour for SE Linux. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'kernel/auditsc.c')
-rw-r--r--kernel/auditsc.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index cb8a44945157..fc858b0c044a 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -530,22 +530,33 @@ static enum audit_state audit_filter_syscall(struct task_struct *tsk,
530 return AUDIT_BUILD_CONTEXT; 530 return AUDIT_BUILD_CONTEXT;
531} 531}
532 532
533int audit_filter_user(struct task_struct *tsk, int type) 533int audit_filter_user(int pid, int type)
534{ 534{
535 struct task_struct *tsk;
535 struct audit_entry *e; 536 struct audit_entry *e;
536 enum audit_state state; 537 enum audit_state state;
538 int ret = 1;
537 539
538 if (audit_pid && tsk->pid == audit_pid) 540 read_lock(&tasklist_lock);
539 return AUDIT_DISABLED; 541 tsk = find_task_by_pid(pid);
542 if (tsk)
543 get_task_struct(tsk);
544 read_unlock(&tasklist_lock);
545
546 if (!tsk)
547 return -ESRCH;
540 548
541 rcu_read_lock(); 549 rcu_read_lock();
542 list_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_USER], list) { 550 list_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_USER], list) {
543 if (audit_filter_rules(tsk, &e->rule, NULL, &state)) { 551 if (audit_filter_rules(tsk, &e->rule, NULL, &state)) {
544 rcu_read_unlock(); 552 if (state == AUDIT_DISABLED)
545 return state != AUDIT_DISABLED; 553 ret = 0;
554 break;
546 } 555 }
547 } 556 }
548 rcu_read_unlock(); 557 rcu_read_unlock();
558 put_task_struct(tsk);
559
549 return 1; /* Audit by default */ 560 return 1; /* Audit by default */
550 561
551} 562}