linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lino Sanfilippo <LinoSanfilippo@gmx.de>
To: Vasily Novikov <vasily.novikov@kaspersky.com>
Cc: Eric Paris <eparis@redhat.com>,
	Tvrtko Ursulin <tvrtko.ursulin@sophos.com>,
	"malware-list@dmesg.printk.net" <malware-list@dmesg.printk.net>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [malware-list] A few concerns about fanotify implementation.
Date: Mon, 6 Jun 2011 12:27:54 +0200	[thread overview]
Message-ID: <20110606102754.GA25313@lsanfilippo.unix.rd.tt.avira.com> (raw)
In-Reply-To: <4DE8ACAD.2080003@kaspersky.com>

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@gmx.de>
---
 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



  parent reply	other threads:[~2011-06-06 10:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-26 12:13 A few concerns about fanotify implementation Vasily Novikov
2010-10-26 12:58 ` [malware-list] " Tvrtko Ursulin
2010-10-26 13:58   ` Vasily Novikov
2010-10-26 14:22     ` Tvrtko Ursulin
     [not found]       ` <201010261522.34157.tvrtko.ursulin-j34lQMj1tz/QT0dZR+AlfA@public.gmane.org>
2010-10-26 14:58         ` Eric Paris
2010-10-27  8:54   ` [malware-list] " Vasily Novikov
2010-10-27 15:58     ` Eric Paris
     [not found]       ` <1288195134.2655.202.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2011-06-03  9:43         ` Vasily Novikov
     [not found]           ` <4DE8ACAD.2080003-BkmlMuIjteXqlBn2x/YWAg@public.gmane.org>
2011-06-06  9:02             ` Douglas Leeder
2011-06-06  9:19               ` [malware-list] " Vasily Novikov
     [not found]                 ` <4DEC9B86.6060506-BkmlMuIjteXqlBn2x/YWAg@public.gmane.org>
2011-06-06 13:43                   ` Eric Paris
2011-06-06 14:42                     ` [malware-list] " Vasily Novikov
     [not found]                       ` <4DECE76E.4060507-BkmlMuIjteXqlBn2x/YWAg@public.gmane.org>
2011-06-06 15:53                         ` Eric Paris
2011-06-07 12:35                           ` [malware-list] " Vasily Novikov
     [not found]               ` <C511438CDC161C41B3C47B91D99ABA8D37B4B42114-u5UUZ0l8pcxUerCGrXd8jcc3qqyFMPEu@public.gmane.org>
2011-06-06  9:42                 ` Vasily Novikov
2011-06-06 10:27           ` Lino Sanfilippo [this message]
2011-06-06 11:17             ` [malware-list] A few concerns about fanotify implementation ([PATCH] inside) Lino Sanfilippo

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=20110606102754.GA25313@lsanfilippo.unix.rd.tt.avira.com \
    --to=linosanfilippo@gmx.de \
    --cc=eparis@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=malware-list@dmesg.printk.net \
    --cc=tvrtko.ursulin@sophos.com \
    --cc=vasily.novikov@kaspersky.com \
    /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;
as well as URLs for NNTP newsgroup(s).