From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Vegard Nossum <vegard.nossum@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: mtk.manpages@gmail.com, Willy Tarreau <w@1wt.eu>,
socketpair@gmail.com,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Jens Axboe <axboe@fb.com>, Al Viro <viro@zeniv.linux.org.uk>,
linux-api@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/8] pipe: fix limit checking in pipe_set_size()
Date: Mon, 22 Aug 2016 09:14:27 +1200 [thread overview]
Message-ID: <8b893c3b-aa41-ffb3-a652-a42a746d26fb@gmail.com> (raw)
In-Reply-To: <f99fff13-aacf-8673-8553-366f6c952654@oracle.com>
On 08/21/2016 10:33 PM, Vegard Nossum wrote:
> On 08/20/2016 01:17 AM, Michael Kerrisk (man-pages) wrote:
>> On 08/20/2016 08:56 AM, Michael Kerrisk (man-pages) wrote:
>>> On 08/19/2016 08:30 PM, Vegard Nossum wrote:
>>>> Is there any reason why we couldn't do the (size > pipe_max_size) check
>>>> before calling account_pipe_buffers()?
>>>
>>> No reason that I can see. Just a little more work to be done in the
>>> code, I think.
>>
>> And, just so I make sure we're understanding each other... I assume you
>> mean changing the code here to something like:
> [...]
>> if (nr_pages > pipe->buffers &&
>> size > pipe_max_size && !capable(CAP_SYS_RESOURCE))
>> return -EPERM;
>>
>> user_bufs = account_pipe_buffers(pipe->user, pipe->buffers, nr_pages);
>>
>> if (nr_pages > pipe->buffers &&
>> too_many_pipe_buffers_hard(user_bufs ||
>> too_many_pipe_buffers_soft(user_bufs)) &&
>> !capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN)) {
>> ret = -EPERM;
>> goto out_revert_acct;
>> }
>>
>> Right?
>
> Yup, that's what I had in mind.
Okay -- changed.
> (The parantheses are messed up though.)
Yup, was just a quick untested edit to make sure we meant the same thing.
Thanks,
Michael
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
next prev parent reply other threads:[~2016-08-21 21:15 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <67ce15aa-cf43-0c89-d079-2d966177c56d@gmail.com>
2016-08-19 5:25 ` [PATCH 1/8] pipe: relocate round_pipe_size() above pipe_set_size() Michael Kerrisk (man-pages)
2016-08-19 5:25 ` [PATCH 2/8] pipe: move limit checking logic into pipe_set_size() Michael Kerrisk (man-pages)
2016-08-19 5:25 ` [PATCH 3/8] pipe: refactor argument for account_pipe_buffers() Michael Kerrisk (man-pages)
2016-08-19 5:25 ` [PATCH 4/8] pipe: fix limit checking in pipe_set_size() Michael Kerrisk (man-pages)
2016-08-19 5:48 ` Willy Tarreau
2016-08-19 20:51 ` Michael Kerrisk (man-pages)
2016-08-21 21:15 ` Michael Kerrisk (man-pages)
2016-08-21 21:35 ` Willy Tarreau
2016-08-22 19:37 ` Michael Kerrisk (man-pages)
2016-08-19 8:30 ` Vegard Nossum
2016-08-19 20:56 ` Michael Kerrisk (man-pages)
2016-08-19 23:17 ` Michael Kerrisk (man-pages)
2016-08-21 10:33 ` Vegard Nossum
2016-08-21 21:14 ` Michael Kerrisk (man-pages) [this message]
2016-08-19 5:25 ` [PATCH 5/8] pipe: simplify logic in alloc_pipe_info() Michael Kerrisk (man-pages)
2016-08-19 5:25 ` [PATCH 6/8] pipe: fix limit checking " Michael Kerrisk (man-pages)
2016-08-19 5:25 ` [PATCH 7/8] pipe: make account_pipe_buffers() return a value, and use it Michael Kerrisk (man-pages)
2016-08-19 9:36 ` Vegard Nossum
2016-08-19 20:51 ` Michael Kerrisk (man-pages)
2016-08-19 5:26 ` [PATCH 8/8] pipe: cap initial pipe capacity according to pipe-max-size limit Michael Kerrisk (man-pages)
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=8b893c3b-aa41-ffb3-a652-a42a746d26fb@gmail.com \
--to=mtk.manpages@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@fb.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=socketpair@gmail.com \
--cc=vegard.nossum@oracle.com \
--cc=viro@zeniv.linux.org.uk \
--cc=w@1wt.eu \
/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).