aboutsummaryrefslogtreecommitdiffstats
path: root/fs/notify
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2010-10-28 17:21:58 -0400
committerEric Paris <eparis@redhat.com>2010-10-28 17:22:15 -0400
commitac7e22dcfafd04c842a02057afd6541c1d613ef9 (patch)
tree54e84b0596d9915f29e56e6b6a8d8370771202c5 /fs/notify
parente7099d8a5a34d2876908a9fab4952dabdcfc5909 (diff)
fanotify: allow userspace to override max marks
Some fanotify groups, especially those like AV scanners, will need to place lots of marks, particularly ignore marks. Since ignore marks do not pin inodes in cache and are cleared if the inode is removed from core (usually under memory pressure) we expose an interface for listeners, with CAP_SYS_ADMIN, to override the maximum number of marks and be allowed to set and 'unlimited' number of marks. Programs which make use of this feature will be able to OOM a machine. Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs/notify')
-rw-r--r--fs/notify/fanotify/fanotify_user.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 1d33d7db277a..f9216102b426 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -707,7 +707,14 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
707 group->max_events = FANOTIFY_DEFAULT_MAX_EVENTS; 707 group->max_events = FANOTIFY_DEFAULT_MAX_EVENTS;
708 } 708 }
709 709
710 group->fanotify_data.max_marks = FANOTIFY_DEFAULT_MAX_MARKS; 710 if (flags & FAN_UNLIMITED_MARKS) {
711 fd = -EPERM;
712 if (!capable(CAP_SYS_ADMIN))
713 goto out_put_group;
714 group->fanotify_data.max_marks = UINT_MAX;
715 } else {
716 group->fanotify_data.max_marks = FANOTIFY_DEFAULT_MAX_MARKS;
717 }
711 718
712 fd = anon_inode_getfd("[fanotify]", &fanotify_fops, group, f_flags); 719 fd = anon_inode_getfd("[fanotify]", &fanotify_fops, group, f_flags);
713 if (fd < 0) 720 if (fd < 0)