]> nv-tegra.nvidia Code Review - linux-3.10.git/blobdiff - security/selinux/avc.c
AUDIT: Add message types to audit records
[linux-3.10.git] / security / selinux / avc.c
index fe6285e5c68f8989710e5a498637f8e494668ef1..042f91e9f9d21f5c97ae97c5cdf663c0ed942821 100644 (file)
@@ -242,7 +242,7 @@ void __init avc_init(void)
        avc_node_cachep = kmem_cache_create("avc_node", sizeof(struct avc_node),
                                             0, SLAB_PANIC, NULL, NULL);
 
-       audit_log(current->audit_context, "AVC INITIALIZED\n");
+       audit_log(current->audit_context, AUDIT_KERNEL, "AVC INITIALIZED\n");
 }
 
 int avc_get_hash_stats(char *page)
@@ -532,7 +532,6 @@ void avc_audit(u32 ssid, u32 tsid,
                u16 tclass, u32 requested,
                struct av_decision *avd, int result, struct avc_audit_data *a)
 {
-       struct task_struct *tsk = current;
        struct inode *inode = NULL;
        u32 denied, audited;
        struct audit_buffer *ab;
@@ -550,45 +549,12 @@ void avc_audit(u32 ssid, u32 tsid,
                        return;
        }
 
-       ab = audit_log_start(current->audit_context);
+       ab = audit_log_start(current->audit_context, AUDIT_AVC);
        if (!ab)
                return;         /* audit_panic has been called */
        audit_log_format(ab, "avc:  %s ", denied ? "denied" : "granted");
        avc_dump_av(ab, tclass,audited);
        audit_log_format(ab, " for ");
-       if (a && a->tsk)
-               tsk = a->tsk;
-       if (tsk && tsk->pid) {
-               struct mm_struct *mm;
-               struct vm_area_struct *vma;
-               audit_log_format(ab, " pid=%d", tsk->pid);
-               if (tsk == current)
-                       mm = current->mm;
-               else
-                       mm = get_task_mm(tsk);
-               if (mm) {
-                       if (down_read_trylock(&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);
-                       } else {
-                               audit_log_format(ab, " comm=%s", tsk->comm);
-                       }
-                       if (tsk != current)
-                               mmput(mm);
-               } else {
-                       audit_log_format(ab, " comm=%s", tsk->comm);
-               }
-       }
        if (a) {
                switch (a->type) {
                case AVC_AUDIT_DATA_IPC: