aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-03-29 20:02:55 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2006-05-01 06:06:07 -0400
commit45d9bb0e37668b7c64d1e49e98fbc4733c23b334 (patch)
tree29b518f84a4e9c4a295dfd92a24b5a5c42c032cc
parente0a515bc6a2188f02916e976f419a8640312e32a (diff)
[PATCH] deal with deadlocks in audit_free()
Don't assume that audit_log_exit() et.al. are called for the context of current; pass task explictly. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--kernel/auditsc.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 7f160df21a23..4052f0aec1d3 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -536,13 +536,13 @@ error_path:
536 return; 536 return;
537} 537}
538 538
539static void audit_log_task_info(struct audit_buffer *ab, gfp_t gfp_mask) 539static void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk, gfp_t gfp_mask)
540{ 540{
541 char name[sizeof(current->comm)]; 541 char name[sizeof(tsk->comm)];
542 struct mm_struct *mm = current->mm; 542 struct mm_struct *mm = tsk->mm;
543 struct vm_area_struct *vma; 543 struct vm_area_struct *vma;
544 544
545 get_task_comm(name, current); 545 get_task_comm(name, tsk);
546 audit_log_format(ab, " comm="); 546 audit_log_format(ab, " comm=");
547 audit_log_untrustedstring(ab, name); 547 audit_log_untrustedstring(ab, name);
548 548
@@ -551,7 +551,7 @@ static void audit_log_task_info(struct audit_buffer *ab, gfp_t gfp_mask)
551 551
552 /* 552 /*
553 * this is brittle; all callers that pass GFP_ATOMIC will have 553 * this is brittle; all callers that pass GFP_ATOMIC will have
554 * NULL current->mm and we won't get here. 554 * NULL tsk->mm and we won't get here.
555 */ 555 */
556 down_read(&mm->mmap_sem); 556 down_read(&mm->mmap_sem);
557 vma = mm->mmap; 557 vma = mm->mmap;
@@ -569,7 +569,7 @@ static void audit_log_task_info(struct audit_buffer *ab, gfp_t gfp_mask)
569 audit_log_task_context(ab, gfp_mask); 569 audit_log_task_context(ab, gfp_mask);
570} 570}
571 571
572static void audit_log_exit(struct audit_context *context, gfp_t gfp_mask) 572static void audit_log_exit(struct audit_context *context, struct task_struct *tsk, gfp_t gfp_mask)
573{ 573{
574 int i; 574 int i;
575 struct audit_buffer *ab; 575 struct audit_buffer *ab;
@@ -587,8 +587,8 @@ static void audit_log_exit(struct audit_context *context, gfp_t gfp_mask)
587 audit_log_format(ab, " success=%s exit=%ld", 587 audit_log_format(ab, " success=%s exit=%ld",
588 (context->return_valid==AUDITSC_SUCCESS)?"yes":"no", 588 (context->return_valid==AUDITSC_SUCCESS)?"yes":"no",
589 context->return_code); 589 context->return_code);
590 if (current->signal->tty && current->signal->tty->name) 590 if (tsk->signal && tsk->signal->tty && tsk->signal->tty->name)
591 tty = current->signal->tty->name; 591 tty = tsk->signal->tty->name;
592 else 592 else
593 tty = "(none)"; 593 tty = "(none)";
594 audit_log_format(ab, 594 audit_log_format(ab,
@@ -720,7 +720,7 @@ void audit_free(struct task_struct *tsk)
720 * We use GFP_ATOMIC here because we might be doing this 720 * We use GFP_ATOMIC here because we might be doing this
721 * in the context of the idle thread */ 721 * in the context of the idle thread */
722 if (context->in_syscall && context->auditable) 722 if (context->in_syscall && context->auditable)
723 audit_log_exit(context, GFP_ATOMIC); 723 audit_log_exit(context, tsk, GFP_ATOMIC);
724 724
725 audit_free_context(context); 725 audit_free_context(context);
726} 726}
@@ -839,7 +839,7 @@ void audit_syscall_exit(struct task_struct *tsk, int valid, long return_code)
839 goto out; 839 goto out;
840 840
841 if (context->in_syscall && context->auditable) 841 if (context->in_syscall && context->auditable)
842 audit_log_exit(context, GFP_KERNEL); 842 audit_log_exit(context, tsk, GFP_KERNEL);
843 843
844 context->in_syscall = 0; 844 context->in_syscall = 0;
845 context->auditable = 0; 845 context->auditable = 0;