public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] prctl: Use CAP_SYS_RESOUCE for PR_SET_MM option
@ 2012-03-07 12:52 Cyrill Gorcunov
  2012-03-07 17:03 ` Kees Cook
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Cyrill Gorcunov @ 2012-03-07 12:52 UTC (permalink / raw)
  To: LKML
  Cc: Michael Kerrisk, Pavel Emelyanov, Tejun Heo, Oleg Nesterov,
	KOSAKI Motohiro, Kees Cook

CAP_SYS_ADMIN is already overloaded left and right,
so to have more finegrained access control use
CAP_SYS_RESOUCE here.

The CAP_SYS_RESOUCE is chosen because this prctl
option allows a current process to adjust some
fields of memory map descriptor which rather
represent what the process owns: pointers to
code, data, stack segments, command line,
auxilary vector data and etc.

Suggested-by: Michael Kerrisk <mtk.manpages@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Pavel Emelyanov <xemul@parallels.com>
CC: Tejun Heo <tj@kernel.org>
CC: Oleg Nesterov <oleg@redhat.com>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
CC: Kees Cook <keescook@chromium.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 kernel/sys.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.git/kernel/sys.c
===================================================================
--- linux-2.6.git.orig/kernel/sys.c
+++ linux-2.6.git/kernel/sys.c
@@ -1712,7 +1712,7 @@ static int prctl_set_mm(int opt, unsigne
 	if (arg5 || (arg4 && opt != PR_SET_MM_AUXV))
 		return -EINVAL;
 
-	if (!capable(CAP_SYS_ADMIN))
+	if (!capable(CAP_SYS_RESOURCE))
 		return -EPERM;
 
 	if (addr >= TASK_SIZE)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] prctl: Use CAP_SYS_RESOUCE for PR_SET_MM option
  2012-03-07 12:52 [PATCH] prctl: Use CAP_SYS_RESOUCE for PR_SET_MM option Cyrill Gorcunov
@ 2012-03-07 17:03 ` Kees Cook
  2012-03-07 20:14 ` Michael Kerrisk (man-pages)
  2012-03-07 20:29 ` Paul Bolle
  2 siblings, 0 replies; 5+ messages in thread
From: Kees Cook @ 2012-03-07 17:03 UTC (permalink / raw)
  To: Cyrill Gorcunov
  Cc: LKML, Michael Kerrisk, Pavel Emelyanov, Tejun Heo, Oleg Nesterov,
	KOSAKI Motohiro

On Wed, Mar 7, 2012 at 4:52 AM, Cyrill Gorcunov <gorcunov@openvz.org> wrote:
> CAP_SYS_ADMIN is already overloaded left and right,
> so to have more finegrained access control use
> CAP_SYS_RESOUCE here.
>
> The CAP_SYS_RESOUCE is chosen because this prctl
> option allows a current process to adjust some
> fields of memory map descriptor which rather
> represent what the process owns: pointers to
> code, data, stack segments, command line,
> auxilary vector data and etc.
>
> Suggested-by: Michael Kerrisk <mtk.manpages@gmail.com>
> CC: Andrew Morton <akpm@linux-foundation.org>
> CC: Pavel Emelyanov <xemul@parallels.com>
> CC: Tejun Heo <tj@kernel.org>
> CC: Oleg Nesterov <oleg@redhat.com>
> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> CC: Kees Cook <keescook@chromium.org>
> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
> ---
>  kernel/sys.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux-2.6.git/kernel/sys.c
> ===================================================================
> --- linux-2.6.git.orig/kernel/sys.c
> +++ linux-2.6.git/kernel/sys.c
> @@ -1712,7 +1712,7 @@ static int prctl_set_mm(int opt, unsigne
>        if (arg5 || (arg4 && opt != PR_SET_MM_AUXV))
>                return -EINVAL;
>
> -       if (!capable(CAP_SYS_ADMIN))
> +       if (!capable(CAP_SYS_RESOURCE))
>                return -EPERM;
>
>        if (addr >= TASK_SIZE)

Yeah, getting away from CAP_SYS_ADMIN is a good idea.

Acked-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook
ChromeOS Security

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] prctl: Use CAP_SYS_RESOUCE for PR_SET_MM option
  2012-03-07 12:52 [PATCH] prctl: Use CAP_SYS_RESOUCE for PR_SET_MM option Cyrill Gorcunov
  2012-03-07 17:03 ` Kees Cook
@ 2012-03-07 20:14 ` Michael Kerrisk (man-pages)
  2012-03-07 20:29 ` Paul Bolle
  2 siblings, 0 replies; 5+ messages in thread
From: Michael Kerrisk (man-pages) @ 2012-03-07 20:14 UTC (permalink / raw)
  To: Cyrill Gorcunov
  Cc: LKML, Pavel Emelyanov, Tejun Heo, Oleg Nesterov, KOSAKI Motohiro,
	Kees Cook

On Thu, Mar 8, 2012 at 1:52 AM, Cyrill Gorcunov <gorcunov@openvz.org> wrote:
> CAP_SYS_ADMIN is already overloaded left and right,
> so to have more finegrained access control use
> CAP_SYS_RESOUCE here.
>
> The CAP_SYS_RESOUCE is chosen because this prctl
> option allows a current process to adjust some
> fields of memory map descriptor which rather
> represent what the process owns: pointers to
> code, data, stack segments, command line,
> auxilary vector data and etc.

Acked-by: Michael Kerrisk <mtk.manpages@gmail.com>



> Suggested-by: Michael Kerrisk <mtk.manpages@gmail.com>
> CC: Andrew Morton <akpm@linux-foundation.org>
> CC: Pavel Emelyanov <xemul@parallels.com>
> CC: Tejun Heo <tj@kernel.org>
> CC: Oleg Nesterov <oleg@redhat.com>
> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> CC: Kees Cook <keescook@chromium.org>
> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
> ---
>  kernel/sys.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux-2.6.git/kernel/sys.c
> ===================================================================
> --- linux-2.6.git.orig/kernel/sys.c
> +++ linux-2.6.git/kernel/sys.c
> @@ -1712,7 +1712,7 @@ static int prctl_set_mm(int opt, unsigne
>        if (arg5 || (arg4 && opt != PR_SET_MM_AUXV))
>                return -EINVAL;
>
> -       if (!capable(CAP_SYS_ADMIN))
> +       if (!capable(CAP_SYS_RESOURCE))
>                return -EPERM;
>
>        if (addr >= TASK_SIZE)



-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] prctl: Use CAP_SYS_RESOUCE for PR_SET_MM option
  2012-03-07 12:52 [PATCH] prctl: Use CAP_SYS_RESOUCE for PR_SET_MM option Cyrill Gorcunov
  2012-03-07 17:03 ` Kees Cook
  2012-03-07 20:14 ` Michael Kerrisk (man-pages)
@ 2012-03-07 20:29 ` Paul Bolle
  2012-03-07 20:33   ` Cyrill Gorcunov
  2 siblings, 1 reply; 5+ messages in thread
From: Paul Bolle @ 2012-03-07 20:29 UTC (permalink / raw)
  To: Cyrill Gorcunov
  Cc: LKML, Michael Kerrisk, Pavel Emelyanov, Tejun Heo, Oleg Nesterov,
	KOSAKI Motohiro, Kees Cook

On Wed, 2012-03-07 at 16:52 +0400, Cyrill Gorcunov wrote:
> CAP_SYS_ADMIN is already overloaded left and right,
> so to have more finegrained access control use
> CAP_SYS_RESOUCE here.
> 
> The CAP_SYS_RESOUCE is chosen because this prctl
> option allows a current process to adjust some
> fields of memory map descriptor which rather
> represent what the process owns: pointers to
> code, data, stack segments, command line,
> auxilary vector data and etc.

Nitpicking: s/CAP_SYS_RESOUCE/CAP_SYS_RESOURCE/ in both the commit
summary and the commit explanation. (And if you change that you might
also do a s/auxilary/auxiliary/ in the commit explanation.)


Paul Bolle


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] prctl: Use CAP_SYS_RESOUCE for PR_SET_MM option
  2012-03-07 20:29 ` Paul Bolle
@ 2012-03-07 20:33   ` Cyrill Gorcunov
  0 siblings, 0 replies; 5+ messages in thread
From: Cyrill Gorcunov @ 2012-03-07 20:33 UTC (permalink / raw)
  To: Paul Bolle
  Cc: LKML, Michael Kerrisk, Pavel Emelyanov, Tejun Heo, Oleg Nesterov,
	KOSAKI Motohiro, Kees Cook

On Wed, Mar 07, 2012 at 09:29:28PM +0100, Paul Bolle wrote:
> On Wed, 2012-03-07 at 16:52 +0400, Cyrill Gorcunov wrote:
> > CAP_SYS_ADMIN is already overloaded left and right,
> > so to have more finegrained access control use
> > CAP_SYS_RESOUCE here.
> > 
> > The CAP_SYS_RESOUCE is chosen because this prctl
> > option allows a current process to adjust some
> > fields of memory map descriptor which rather
> > represent what the process owns: pointers to
> > code, data, stack segments, command line,
> > auxilary vector data and etc.
> 
> Nitpicking: s/CAP_SYS_RESOUCE/CAP_SYS_RESOURCE/ in both the commit
> summary and the commit explanation. (And if you change that you might
> also do a s/auxilary/auxiliary/ in the commit explanation.)

Oh, crap! Thanks Paul, patch was unrefreshed, while I was testing
correct version. Will update.

To Andrew: Please don't pick it up. I'll refresh and send it out
again wtih all Acks.

	Cyrill

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-03-07 20:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-07 12:52 [PATCH] prctl: Use CAP_SYS_RESOUCE for PR_SET_MM option Cyrill Gorcunov
2012-03-07 17:03 ` Kees Cook
2012-03-07 20:14 ` Michael Kerrisk (man-pages)
2012-03-07 20:29 ` Paul Bolle
2012-03-07 20:33   ` Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox