From: Eric Paris <eparis@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: hch@infradead.org, akpm@linux-foundation.org
Subject: [PATCH 2/3] fsnotify: sys_execve and sys_uselib do not call into fsnotify
Date: Mon, 15 Dec 2008 11:44:14 -0500 [thread overview]
Message-ID: <20081215164414.2018.66642.stgit@paris.rdu.redhat.com> (raw)
In-Reply-To: <20081215164016.2018.4813.stgit@paris.rdu.redhat.com>
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@redhat.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)
next prev parent reply other threads:[~2008-12-15 16:44 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-15 16:44 [PATCH 0/3] send notification events about exec Eric Paris
2008-12-15 16:44 ` [PATCH 1/3] filesystem notification: create fs/notify to contain all fs notification Eric Paris
2008-12-16 1:02 ` KOSAKI Motohiro
2008-12-16 1:37 ` Eric Paris
2008-12-16 1:46 ` KOSAKI Motohiro
2008-12-15 16:44 ` Eric Paris [this message]
2008-12-16 1:02 ` [PATCH 2/3] fsnotify: sys_execve and sys_uselib do not call into fsnotify KOSAKI Motohiro
2008-12-15 16:44 ` [PATCH 3/3] fsnotify: use the new open-exec hook for inotify and dnotify Eric Paris
2008-12-16 1:12 ` KOSAKI Motohiro
2008-12-16 1:52 ` Eric Paris
2008-12-16 2:01 ` KOSAKI Motohiro
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081215164414.2018.66642.stgit@paris.rdu.redhat.com \
--to=eparis@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®