lkml.org 
[lkml]   [2016]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 4/8] pipe: fix limit checking in pipe_set_size()
From
Date
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. (The parantheses are messed up though.)


Vegard

\
 
 \ /
  Last update: 2016-09-17 09:57    [W:1.007 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site