lkml.org 
[lkml]   [2009]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 3/9] exec_path 3/9: switch TOMOYO to ->exec_path
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
security/tomoyo/common.c | 18 ++++++------------
1 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index ddfb9cc..d26deea 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -10,6 +10,7 @@
*/

#include <linux/uaccess.h>
+#include <linux/path.h>
#include <linux/security.h>
#include <linux/hardirq.h>
#include "realpath.h"
@@ -700,20 +701,13 @@ bool tomoyo_io_printf(struct tomoyo_io_buffer *head, const char *fmt, ...)
*/
static const char *tomoyo_get_exe(void)
{
- struct mm_struct *mm = current->mm;
- struct vm_area_struct *vma;
+ struct path exec_path;
const char *cp = NULL;

- if (!mm)
- return NULL;
- down_read(&mm->mmap_sem);
- for (vma = mm->mmap; vma; vma = vma->vm_next) {
- if ((vma->vm_flags & VM_EXECUTABLE) && vma->vm_file) {
- cp = tomoyo_realpath_from_path(&vma->vm_file->f_path);
- break;
- }
- }
- up_read(&mm->mmap_sem);
+ get_task_exec_path(current, &exec_path);
+ if (exec_path.mnt && exec_path.dentry)
+ cp = tomoyo_realpath_from_path(&exec_path);
+ path_put(&exec_path);
return cp;
}


\
 
 \ /
  Last update: 2009-06-04 01:13    [W:0.132 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site