[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081014205244.1057.94484.stgit@paris.rdu.redhat.com>
Date: Tue, 14 Oct 2008 16:52:44 -0400
From: Eric Paris <eparis@...hat.com>
To: linux-kernel@...r.kernel.org, malware-list@...ts.printk.net
Cc: viro@...IV.linux.org.uk, alan@...rguk.ukuu.org.uk,
arjan@...radead.org, greg@...ah.com, tytso@....edu
Subject: [PATCH -v2 14/16] fanotify: send pid with fanotify notification events
Often things like AV scanners may want to allow access to 'bad' files
based on the process making the access help by sending the pid of the
originally acting process.
Signed-off-by: Eric Paris <eparis@...hat.com>
---
fs/notify/fanotify.h | 1 +
fs/notify/notification.c | 3 +++
include/linux/fanotify.h | 1 +
3 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/fs/notify/fanotify.h b/fs/notify/fanotify.h
index d65db61..74e5d4d 100644
--- a/fs/notify/fanotify.h
+++ b/fs/notify/fanotify.h
@@ -48,6 +48,7 @@ struct fanotify_event {
atomic_t refcnt; /* how many groups still are using/need to send this event */
/* if waiting for a userspace access answer this is the cookie they will send back */
unsigned long cookie;
+ pid_t pid; /* pid of the original process */
spinlock_t response_lock; /* protects response */
unsigned int response; /* userspace answer to question */
};
diff --git a/fs/notify/notification.c b/fs/notify/notification.c
index dd0d2db..da2045a 100644
--- a/fs/notify/notification.c
+++ b/fs/notify/notification.c
@@ -181,6 +181,8 @@ struct fanotify_event *create_event(struct file *file, unsigned int mask)
event->cookie = 0;
event->mask = mask;
+ event->pid = current->pid;
+
WARN_ON(!event->path.dentry);
WARN_ON(!event->path.mnt);
@@ -245,6 +247,7 @@ int fanotify_create_event_fd(struct fanotify_group *group, struct fanotify_event
data->fd = client_fd;
data->mask = event->mask;
data->cookie = event->cookie;
+ data->pid = event->pid;
fanotify_put_event(event);
diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h
index a36bd6b..ab7744a 100644
--- a/include/linux/fanotify.h
+++ b/include/linux/fanotify.h
@@ -71,6 +71,7 @@ struct fanotify_event_metadata {
int32_t fd;
uint32_t mask;
uint64_t cookie;
+ pid_t pid;
};
/* fanotify getsockopt optvals */
--
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