[Devel] [PATCH 2/9] exec_path 2/9: switch audit to ->exec_path

Alexey Dobriyan adobriyan at gmail.com
Wed Jun 3 16:05:20 PDT 2009


Signed-off-by: Alexey Dobriyan <adobriyan at gmail.com>
---
 kernel/auditsc.c |   23 +++++++----------------
 1 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 7d6ac7c..76829b6 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -53,6 +53,7 @@
 #include <linux/socket.h>
 #include <linux/mqueue.h>
 #include <linux/audit.h>
+#include <linux/path.h>
 #include <linux/personality.h>
 #include <linux/time.h>
 #include <linux/netlink.h>
@@ -949,8 +950,7 @@ EXPORT_SYMBOL(audit_log_task_context);
 static void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
 {
 	char name[sizeof(tsk->comm)];
-	struct mm_struct *mm = tsk->mm;
-	struct vm_area_struct *vma;
+	struct path exec_path;
 
 	/* tsk == current */
 
@@ -958,20 +958,11 @@ static void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk
 	audit_log_format(ab, " comm=");
 	audit_log_untrustedstring(ab, name);
 
-	if (mm) {
-		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_path);
-				break;
-			}
-			vma = vma->vm_next;
-		}
-		up_read(&mm->mmap_sem);
-	}
+	get_task_exec_path(tsk, &exec_path);
+	if (exec_path.mnt && exec_path.dentry)
+		audit_log_d_path(ab, "exe=", &exec_path);
+	path_put(&exec_path);
+
 	audit_log_task_context(ab);
 }
 
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list