[Devel] [PATCH 3/9] exec_path 3/9: switch TOMOYO to ->exec_path
Alexey Dobriyan
adobriyan at gmail.com
Wed Jun 3 16:05:50 PDT 2009
Signed-off-by: Alexey Dobriyan <adobriyan at 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;
}
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list