diff options
author | Stephen Smalley <sds@tycho.nsa.gov> | 2005-04-18 10:47:35 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-18 10:47:35 -0700 |
commit | 219f0817038cabc722968e914490adf6b686499e (patch) | |
tree | 13b64537abe906645ee22843e146e21958236219 /kernel | |
parent | 865108d13801d39ec038bdc82b5bec5e1eaffa9d (diff) | |
download | op-kernel-dev-219f0817038cabc722968e914490adf6b686499e.zip op-kernel-dev-219f0817038cabc722968e914490adf6b686499e.tar.gz |
[PATCH] SELinux: fix deadlock on dcache lock
This fixes a deadlock on the dcache lock detected during testing at IBM
by moving the logging of the current executable information from the
SELinux avc_audit function to audit_log_exit (via an audit_log_task_info
helper) for processing upon syscall exit.
For consistency, the patch also removes the logging of other
task-related information from avc_audit, deferring handling to
audit_log_exit instead.
This allows simplification of the avc_audit code, allows the exe
information to be obtained more reliably, always includes the comm
information (useful for scripts), and avoids including bogus task
information for checks performed from irq or softirq.
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: James Morris <jmorris@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/auditsc.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 8c45485..6f19313 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -610,6 +610,33 @@ static inline void audit_free_context(struct audit_context *context) printk(KERN_ERR "audit: freed %d contexts\n", count); } +static void audit_log_task_info(struct audit_buffer *ab) +{ + char name[sizeof(current->comm)]; + struct mm_struct *mm = current->mm; + struct vm_area_struct *vma; + + get_task_comm(name, current); + audit_log_format(ab, " comm=%s", name); + + if (!mm) + return; + + down_read(&mm->mmap_sem); + vma = mm->mmap; + while (vma) { + if ((vma->vm_flags & VM_EXECUTABLE) && + vma->vm_file) { + audit_log_d_path(ab, "exe=", + vma->vm_file->f_dentry, + vma->vm_file->f_vfsmnt); + break; + } + vma = vma->vm_next; + } + up_read(&mm->mmap_sem); +} + static void audit_log_exit(struct audit_context *context) { int i; @@ -639,6 +666,7 @@ static void audit_log_exit(struct audit_context *context) context->gid, context->euid, context->suid, context->fsuid, context->egid, context->sgid, context->fsgid); + audit_log_task_info(ab); audit_log_end(ab); while (context->aux) { struct audit_aux_data *aux; |