From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lino Sanfilippo Subject: Re: [malware-list] A few concerns about fanotify implementation ([PATCH] inside). Date: Mon, 6 Jun 2011 13:17:00 +0200 Message-ID: <20110606111700.GC25313@lsanfilippo.unix.rd.tt.avira.com> References: <1288095195.29745.4010.camel@novikov-v> <201010261358.46974.tvrtko.ursulin@sophos.com> <1288169699.7715.103.camel@novikov-v> <1288195134.2655.202.camel@localhost.localdomain> <4DE8ACAD.2080003@kaspersky.com> <20110606102754.GA25313@lsanfilippo.unix.rd.tt.avira.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Vasily Novikov , Eric Paris , Tvrtko Ursulin , "malware-list@dmesg.printk.net" , "linux-fsdevel@vger.kernel.org" To: Lino Sanfilippo Return-path: Received: from mailout-de.gmx.net ([213.165.64.22]:49637 "HELO mailout-de.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1755015Ab1FFLSi (ORCPT ); Mon, 6 Jun 2011 07:18:38 -0400 Content-Disposition: inline In-Reply-To: <20110606102754.GA25313@lsanfilippo.unix.rd.tt.avira.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, Jun 06, 2011 at 12:27:54PM +0200, Lino Sanfilippo wrote: > The applied patch should handle this correctly. Should but doesnt, since access permission handling might not be enabled. So here is an improved version: Signed-off-by: Lino Sanfilippo --- fs/notify/fanotify/fanotify_user.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index 9fde1c0..527fbb0 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c @@ -306,8 +306,15 @@ static unsigned int fanotify_poll(struct file *file, poll_table *wait) poll_wait(file, &group->notification_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); +#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS + poll_wait(file, &group->fanotify_data.access_waitq, wait); + 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); +#endif return ret; } -- 1.5.6.5