[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081215164414.2018.66642.stgit@paris.rdu.redhat.com>
Date: Mon, 15 Dec 2008 11:44:14 -0500
From: Eric Paris <eparis@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: hch@...radead.org, akpm@...ux-foundation.org
Subject: [PATCH 2/3] fsnotify: sys_execve and sys_uselib do not call into
fsnotify
sys_execve and sys_uselib do not call into fsnotify so inotify and dnotify do
not see opens on things which are going to be exectued. This patch creates a
generic fsnotify hook for these operations
Signed-off-by: Eric Paris <eparis@...hat.com>
---
fs/exec.c | 5 +++++
include/linux/fsnotify.h | 7 +++++++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/fs/exec.c b/fs/exec.c
index ec5df9a..8a659a8 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -51,6 +51,7 @@
#include <linux/audit.h>
#include <linux/tracehook.h>
#include <linux/kmod.h>
+#include <linux/fsnotify.h>
#include <asm/uaccess.h>
#include <asm/mmu_context.h>
@@ -135,6 +136,8 @@ asmlinkage long sys_uselib(const char __user * library)
if (IS_ERR(file))
goto out;
+ fsnotify_open_exec(file);
+
error = -ENOEXEC;
if(file->f_op) {
struct linux_binfmt * fmt;
@@ -687,6 +690,8 @@ struct file *open_exec(const char *name)
if (IS_ERR(file))
return file;
+ fsnotify_open_exec(file);
+
err = deny_write_access(file);
if (err) {
fput(file);
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 00fbd5b..88265dd 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -166,6 +166,13 @@ static inline void fsnotify_modify(struct dentry *dentry)
}
/*
+ * fsnotify_open_exec - file was opened by execve or uselib
+ */
+static inline void fsnotify_open_exec(struct file *file)
+{
+}
+
+/*
* fsnotify_open - file was opened
*/
static inline void fsnotify_open(struct dentry *dentry)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists