Re: [malware-list] A few concerns about fanotify implementation.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 03, 2011 at 01:43:09PM +0400, Vasily Novikov wrote:

> 3. The fanotify file descriptor is always ready to be written to it. But  

This is not correct. The fanotify file is only writeable if there is
at least one event on the access list (meaning at least one file access event
has been read but not already been confirmed by userspace).
Otherwise you will get -ENOENT.

The applied patch should handle this correctly.

Lino


Signed-off-by: Lino Sanfilippo <LinoSanfilippo@xxxxxx>
---
 fs/notify/fanotify/fanotify_user.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 9fde1c0..f39bcc4 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -304,10 +304,15 @@ static unsigned int fanotify_poll(struct file *file, poll_table *wait)
 	int ret = 0;
 
 	poll_wait(file, &group->notification_waitq, wait);
+	poll_wait(file, &group->fanotify_data.access_waitq, wait);
 	mutex_lock(&group->notification_mutex);
 	if (!fsnotify_notify_queue_is_empty(group))
-		ret = POLLIN | POLLRDNORM;
+		ret |= POLLIN | POLLRDNORM;
 	mutex_unlock(&group->notification_mutex);
+	mutex_lock(&group->fanotify_data.access_mutex);
+	if (!list_empty(&group->fanotify_data.access_list))
+		ret |= POLLOUT | POLLWRNORM;
+	mutex_unlock(&group->fanotify_data.access_mutex);
 
 	return ret;
 }
-- 
1.5.6.5


--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux