Re: [PATCH] prctl: Use CAP_SYS_RESOUCE for PR_SET_MM option

From: Michael Kerrisk (man-pages)
Date: Wed Mar 07 2012 - 15:14:32 EST


On Thu, Mar 8, 2012 at 1:52 AM, Cyrill Gorcunov <gorcunov@xxxxxxxxxx> 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@xxxxxxxxx>



> Suggested-by: Michael Kerrisk <mtk.manpages@xxxxxxxxx>
> CC: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> CC: Pavel Emelyanov <xemul@xxxxxxxxxxxxx>
> CC: Tejun Heo <tj@xxxxxxxxxx>
> CC: Oleg Nesterov <oleg@xxxxxxxxxx>
> CC: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
> CC: Kees Cook <keescook@xxxxxxxxxxxx>
> Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
> ---
>  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/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/