platform_external_selinux/policycoreutils/restorecond
Martin Orr 72ea5dec7c policycoreutils: Fix infinite loop with inotify on 2.6.31 kernels
With kernel 2.6.31, restorecond uses 99% of my CPU.

This is because removing and readding the watch on utmp triggers inotify to
return an IN_IGNORED event for the old watch descriptor.  If the watch gets
allocated the same wd when it is readded, then restorecond thinks that utmp
has changed, so removes and readds the watch again, potentially looping.

With kernel <= 2.6.30, this never happened, because the kernel didn't reuse
watch descriptors.  So the IN_IGNORED event comes with a wd that is no
longer in use, and gets ignored.  But kernel 2.6.31 reuses the same watch
descriptor.  The kernel has been fixed to not reuse watch descriptors.
However as some kernels do reuse them, and its possible they may again,
this patch fixes that by ignoring inotify events whose only bit set is
IN_IGNORED.

Signed-off-by: Martin Orr <martin@martinorr.name>
Signed-off-by: Manoj Srivastava <srivasta@debian.org>
Signed-off-by: Laurent Bigonville <bigon@debian.org>
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
2012-03-28 14:52:14 -04:00
..
Makefile policycoreutils: restorecond: make restorecond dbuss-able 2011-11-02 16:22:05 -04:00
org.selinux.Restorecond.service policycoreutils: restorecond: make restorecond dbuss-able 2011-11-02 16:22:05 -04:00
restorecond.8 policycoreutils: restorecond: make restorecond dbuss-able 2011-11-02 16:22:05 -04:00
restorecond.c policycoreutils: restorecond: make restorecond dbuss-able 2011-11-02 16:22:05 -04:00
restorecond.conf policycoreutils: restorecond: make restorecond dbuss-able 2011-11-02 16:22:05 -04:00
restorecond.desktop policycoreutils: restorecond: make restorecond dbuss-able 2011-11-02 16:22:05 -04:00
restorecond.h policycoreutils: restorecond: make restorecond dbuss-able 2011-11-02 16:22:05 -04:00
restorecond.init policycoreutils: restorecond: make restorecond dbuss-able 2011-11-02 16:22:05 -04:00
restorecond_user.conf policycoreutils: restorecond: Add .local/share as a directory to watch 2011-11-02 16:22:06 -04:00
stringslist.c Author: Daniel J Walsh 2009-02-17 11:42:15 -05:00
stringslist.h Author: Daniel J Walsh 2009-02-17 11:42:15 -05:00
user.c policycoreutils: restorecond: Stop using deprecated interfaces for g_io 2012-03-28 14:52:00 -04:00
utmpwatcher.c restorecond: first user logged in is not noticed 2011-08-02 13:32:23 -04:00
utmpwatcher.h initial import from svn trunk revision 2950 2008-08-19 15:30:36 -04:00
watch.c policycoreutils: Fix infinite loop with inotify on 2.6.31 kernels 2012-03-28 14:52:14 -04:00