Re: [PATCH 12/20] fanotify: allow userspace to override max marks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 28 Oct 2010 22:32:44 Eric Paris wrote:
> 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@xxxxxxxxxx>
> ---
>
>  fs/notify/fanotify/fanotify_user.c |    9 ++++++++-
>  include/linux/fanotify.h           |    4 +++-
>  2 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/fs/notify/fanotify/fanotify_user.c
> b/fs/notify/fanotify/fanotify_user.c index 1d33d7d..f921610 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) group->max_events =
> FANOTIFY_DEFAULT_MAX_EVENTS;
>       }
>
> -     group->fanotify_data.max_marks = FANOTIFY_DEFAULT_MAX_MARKS;
> +     if (flags & FAN_UNLIMITED_MARKS) {
> +             fd = -EPERM;
> +             if (!capable(CAP_SYS_ADMIN))
> +                     goto out_put_group;

Same redundant (or not) capable as with queue depth.

Tvrtko

Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon, OX14 3YP, United Kingdom.
Company Reg No 2096520. VAT Reg No GB 348 3873 20.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux