From: Andrea Righi <righi.andrea-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
Cc: Andrea Righi <andrea-oIIqvOZpAevzfdHfmsDf5w@public.gmane.org>,
Dave Chinner <david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org>,
Andrew Morton
<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
Al Viro <viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org>,
Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC] [PATCH] drop_pagecache syscall
Date: Wed, 27 Apr 2011 11:57:10 +0200 [thread overview]
Message-ID: <20110427095709.GA1687@linux.develer.com> (raw)
In-Reply-To: <BANLkTi=ZNq4Yp3U5jVspsJixu4ckbdVjtQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Wed, Apr 27, 2011 at 05:50:04AM -0400, Mike Frysinger wrote:
> On Wed, Apr 27, 2011 at 05:47, Andrea Righi wrote:
> > On Wed, Apr 27, 2011 at 05:10:41AM -0400, Mike Frysinger wrote:
> >> On Wed, Apr 27, 2011 at 05:01, Andrea Righi wrote:
> >> > On Wed, Apr 27, 2011 at 10:14:53AM +1000, Dave Chinner wrote:
> >> >> On Tue, Apr 26, 2011 at 11:35:27PM +0200, Andrea Righi wrote:
> >> >> > This functionality can be used by all the applications that want to have a
> >> >> > better control over the page cache management (for example to immediately drop
> >> >> > pages that for sure will not be reused in the near future, without calling
> >> >> > posix_fadvise() for all the files they've touched), or to provide a more fine
> >> >> > grained debugging feature usable by the filesystem benchmarks.
> >> >> >
> >> >> > The system call does not require root privileges and it can be called by any
> >> >> > unprivileged application. For example, we can write a userspace tool to run
> >> >> > something like this:
> >> >> >
> >> >> > $ drop-pagecache /path/file_or_dir
> >> >>
> >> >> That's a potential DOS vector, I think. Drop the pagecache in a hard
> >> >> loop on the root fs of a busy server and watch it crawl...
> >> >
> >> > Yes, probably we could allow only the CAP_SYS_ADMIN tasks to execute
> >> > this syscall.
> >>
> >> if /proc/sys/vm/drop_caches has any checks other than file permission
> >> checks (i.e. UID==0), it'd probably be better to copy those rather
> >> than picking something different.
> >
> > ok, what about checking current_euid() == 0?
>
> that's not what i meant. if the drop_caches file already has certain
> cap checks/whatever in place, let's use those. if it doesnt, then
> picking a cap level as you proposed makes sense.
mmh, drop_caches has a file ownership (root:root) and a permission mask
(0644), how to apply the same checks to a system call? The most similar
thing seems to check the current euid. Am I missing something?
-Andrea
WARNING: multiple messages have this Message-ID (diff)
From: Andrea Righi <righi.andrea@gmail.com>
To: Mike Frysinger <vapier@gentoo.org>
Cc: Andrea Righi <andrea@betterlinux.com>,
Dave Chinner <david@fromorbit.com>,
Andrew Morton <akpm@linux-foundation.org>,
Al Viro <viro@zeniv.linux.org.uk>, Arnd Bergmann <arnd@arndb.de>,
linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [RFC] [PATCH] drop_pagecache syscall
Date: Wed, 27 Apr 2011 11:57:10 +0200 [thread overview]
Message-ID: <20110427095709.GA1687@linux.develer.com> (raw)
In-Reply-To: <BANLkTi=ZNq4Yp3U5jVspsJixu4ckbdVjtQ@mail.gmail.com>
On Wed, Apr 27, 2011 at 05:50:04AM -0400, Mike Frysinger wrote:
> On Wed, Apr 27, 2011 at 05:47, Andrea Righi wrote:
> > On Wed, Apr 27, 2011 at 05:10:41AM -0400, Mike Frysinger wrote:
> >> On Wed, Apr 27, 2011 at 05:01, Andrea Righi wrote:
> >> > On Wed, Apr 27, 2011 at 10:14:53AM +1000, Dave Chinner wrote:
> >> >> On Tue, Apr 26, 2011 at 11:35:27PM +0200, Andrea Righi wrote:
> >> >> > This functionality can be used by all the applications that want to have a
> >> >> > better control over the page cache management (for example to immediately drop
> >> >> > pages that for sure will not be reused in the near future, without calling
> >> >> > posix_fadvise() for all the files they've touched), or to provide a more fine
> >> >> > grained debugging feature usable by the filesystem benchmarks.
> >> >> >
> >> >> > The system call does not require root privileges and it can be called by any
> >> >> > unprivileged application. For example, we can write a userspace tool to run
> >> >> > something like this:
> >> >> >
> >> >> > $ drop-pagecache /path/file_or_dir
> >> >>
> >> >> That's a potential DOS vector, I think. Drop the pagecache in a hard
> >> >> loop on the root fs of a busy server and watch it crawl...
> >> >
> >> > Yes, probably we could allow only the CAP_SYS_ADMIN tasks to execute
> >> > this syscall.
> >>
> >> if /proc/sys/vm/drop_caches has any checks other than file permission
> >> checks (i.e. UID==0), it'd probably be better to copy those rather
> >> than picking something different.
> >
> > ok, what about checking current_euid() == 0?
>
> that's not what i meant. if the drop_caches file already has certain
> cap checks/whatever in place, let's use those. if it doesnt, then
> picking a cap level as you proposed makes sense.
mmh, drop_caches has a file ownership (root:root) and a permission mask
(0644), how to apply the same checks to a system call? The most similar
thing seems to check the current euid. Am I missing something?
-Andrea
next prev parent reply other threads:[~2011-04-27 9:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-26 21:35 [RFC] [PATCH] drop_pagecache syscall Andrea Righi
[not found] ` <1303853727-21444-1-git-send-email-andrea-oIIqvOZpAevzfdHfmsDf5w@public.gmane.org>
2011-04-27 0:14 ` Dave Chinner
2011-04-27 0:14 ` Dave Chinner
2011-04-27 9:01 ` Andrea Righi
2011-04-27 9:01 ` Andrea Righi
2011-04-27 9:10 ` Mike Frysinger
[not found] ` <BANLkTimrpNOHVfnund7uc=thf-c3_HxyYQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-04-27 9:47 ` Andrea Righi
2011-04-27 9:47 ` Andrea Righi
2011-04-27 9:50 ` Mike Frysinger
[not found] ` <BANLkTi=ZNq4Yp3U5jVspsJixu4ckbdVjtQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-04-27 9:57 ` Andrea Righi [this message]
2011-04-27 9:57 ` Andrea Righi
[not found] ` <20110427095709.GA1687-fxUVXftIFDlZdMzt4l2sLQC/G2K4zDHf@public.gmane.org>
2011-04-27 15:25 ` Mike Frysinger
2011-04-27 15:25 ` Mike Frysinger
[not found] ` <BANLkTi=+E+WzUgqEQTnRPmL1g5yPsXu8Bw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-04-27 15:42 ` Andrea Righi
2011-04-27 15:42 ` Andrea Righi
[not found] ` <20110427085910.GA1749-Td79XgCuBx/ToqTmb/eOq0M9+F4ksjoh@public.gmane.org>
2011-04-28 23:22 ` Joel Becker
2011-04-28 23:22 ` Joel Becker
[not found] ` <20110428232210.GA4132-EPe72S9iottSzHKm+aFRNNkmqwFzkYv6@public.gmane.org>
2011-04-29 8:18 ` Andrea Righi
2011-04-29 8:18 ` Andrea Righi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110427095709.GA1687@linux.develer.com \
--to=righi.andrea-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=andrea-oIIqvOZpAevzfdHfmsDf5w@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org \
--cc=viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.