lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090727172542.GA5104@blimp.localdomain>
Date:	Mon, 27 Jul 2009 19:25:42 +0200
From:	Alex Riesen <raa.lkml@...il.com>
To:	linux-kernel <linux-kernel@...r.kernel.org>
Cc:	fs_other@...nel-bugs.osdl.org,
	Russell Bell <russellbell@...il.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Al Viro <viro@...iv.linux.org.uk>, josef@...hat.com,
	Eric Paris <eparis@...hat.com>, Robert Love <rlove@...ve.org>,
	John McCutchan <john@...nmccutchan.com>
Subject: [PATCH] inotify: fix the running away counter of user watches

The counter of userspace inotify watches is incremented when a watch is
added, but was never decremented. This patch uses the fsnotify callback
(freeing_marks, which in turn calls inotify_ignored_and_remove_idr of
inotify userspace interface) called when an fsnotify mark is removed.

The bug has been reported in

    http://bugzilla.kernel.org/show_bug.cgi?id=12754

Signed-off-by: Alex Riesen <raa.lkml@...il.com>
---

Sorry for long Cc:, I'm a little confused about "fs_other@" (and the
list of participants) in the bug report.

The patch works in my limited testing. I just did:

    # echo 10 >/proc/sys/fs/inotify/max_user_watches
    # inotify-watch -r /lib # to max the counter
    Ctrl-C
    # inotify-watch /bin/true # must work

in a clean environment (init=/bin/bash).

But I don't know whether it safe to access the counter in this
callback, nor am I sure the patch is enough.

 fs/notify/inotify/inotify_user.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index ff27a29..c2d94df 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -404,6 +404,7 @@ skip_send_ignore:
 
 	/* removed from idr, drop that reference */
 	fsnotify_put_mark(entry);
+	atomic_dec(&group->inotify_data.user->inotify_watches);
 }
 
 /* ding dong the mark is dead */
-- 
1.6.4.rc3.56.g32a7


--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ