Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1306456

Re: [PATCH v2] pipe: limit the per-user amount of pages allocated in pipes

From Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Newsgroups linux.kernel
Subject Re: [PATCH v2] pipe: limit the per-user amount of pages allocated in pipes
Date 2016-01-11 17:20 +0100
Message-ID <qPNmh-4Mf-1@gated-at.bofh.it> (permalink)
References <qPJLH-2jg-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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;
  }

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] pipe: limit the per-user amount of pages allocated in pipes Willy Tarreau <w@1wt.eu> - 2016-01-11 13:30 +0100
  Re: [PATCH v2] pipe: limit the per-user amount of pages allocated in pipes Willy Tarreau <w@1wt.eu> - 2016-01-11 13:40 +0100
  Re: [PATCH v2] pipe: limit the per-user amount of pages allocated in pipes Willy Tarreau <w@1wt.eu> - 2016-01-11 13:40 +0100
  Re: [PATCH v2] pipe: limit the per-user amount of pages allocated in pipes Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-01-11 17:20 +0100
    Re: [PATCH v2] pipe: limit the per-user amount of pages allocated in pipes Willy Tarreau <w@1wt.eu> - 2016-01-11 17:30 +0100
      Re: [PATCH v2] pipe: limit the per-user amount of pages allocated in pipes Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> - 2016-01-11 17:50 +0100

csiph-web