From: Willy Tarreau <w@1wt.eu>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
socketpair@gmail.com
Subject: Re: [PATCH v2] pipe: limit the per-user amount of pages allocated in pipes
Date: Mon, 11 Jan 2016 17:24:44 +0100 [thread overview]
Message-ID: <20160111162444.GA20163@1wt.eu> (raw)
In-Reply-To: <201601120119.JHB51017.JFOFtSOLOMHVFQ@I-love.SAKURA.ne.jp>
On Tue, Jan 12, 2016 at 01:19:00AM +0900, Tetsuo Handa wrote:
> Willy Tarreau wrote:
> > @@ -1066,7 +1094,8 @@ long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg)
> > if (!nr_pages)
> > goto out;
> >
> > - if (!capable(CAP_SYS_RESOURCE) && size > pipe_max_size) {
> > + if (!capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN) &&
> > + (size > pipe_max_size || too_many_pipe_buffers(pipe->user))) {
> > ret = -EPERM;
> > goto out;
> > }
>
> I think we should not check capable(CAP_SYS_ADMIN) for size > pipe_max_size
> case, for checking capable(CAP_SYS_ADMIN) needlessly generates audit logs and
> also loosens permission required for setting size > pipe_max_size.
>
> Also, I think we should not check capable(CAP_SYS_ADMIN) unless
> too_many_pipe_buffers(pipe->user) is true, for checking capable(CAP_SYS_ADMIN)
> needlessly generates audit logs.
>
> Since too_many_unix_fds() requires capable(CAP_SYS_ADMIN) || capable(CAP_SYS_ADMIN),
> I think what we want is something like below?
>
> if (!capable(CAP_SYS_RESOURCE) && size > pipe_max_size) {
> ret = -EPERM;
> goto out;
> } else if (too_many_pipe_buffers(pipe->user) &&
> !capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN)) {
> ret = -EPERM;
> goto out;
> }
OK that works for me. Do you have an opinion regarding my other proposal of
soft vs hard limit ?
Thanks,
Willy
next prev parent reply other threads:[~2016-01-11 16:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-11 8:56 [PATCH v2] pipe: limit the per-user amount of pages allocated in pipes Willy Tarreau
2016-01-11 12:37 ` Willy Tarreau
2016-01-11 12:38 ` Willy Tarreau
2016-01-11 16:19 ` Tetsuo Handa
2016-01-11 16:24 ` Willy Tarreau [this message]
2016-01-11 16:45 ` Tetsuo Handa
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=20160111162444.GA20163@1wt.eu \
--to=w@1wt.eu \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=socketpair@gmail.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).