Skip to contentSkip to conversation

prctl: Use CAP_SYS_RESOUCE for PR_SET_MM option

PATCH In review Cyrill Gorcunov 4 participants 5 messages Mar 7, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 prctl: Use CAP_SYS_RESOUCE for PR_SET_MM option

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.

CC Andrew Morton <[email protected]>
CC Pavel Emelyanov <[email protected]>
CC Tejun Heo <[email protected]>
CC Oleg Nesterov <[email protected]>
CC KOSAKI Motohiro <[email protected]>
CC Kees Cook <[email protected]>
---
 kernel/sys.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sys.c +1 -1
Index: 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)
Acked-by on v1 1/1
#1 lore raw
Quoted 28 lines · Cyrill Gorcunov

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.

CC Andrew Morton <[email protected]>
CC Pavel Emelyanov <[email protected]>
CC Tejun Heo <[email protected]>
CC Oleg Nesterov <[email protected]>
CC KOSAKI Motohiro <[email protected]>
CC Kees Cook <[email protected]>

---
 kernel/sys.c |    2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.git/kernel/sys.c
===================================================================

kernel/sys.c static int prctl_set_mm(int opt, unsigne · line 1718

Quoted 8 lines
kernel/sys.c +1 -1
@@ -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.

Signature · 2 lines
Kees Cook
ChromeOS Security
Acked-by on v1 1/1
#2 lore raw
In reply to Cyrill Gorcunov
Quoted 10 lines · Cyrill Gorcunov

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.

Quoted 25 lines
CC Andrew Morton <[email protected]>
CC Pavel Emelyanov <[email protected]>
CC Tejun Heo <[email protected]>
CC Oleg Nesterov <[email protected]>
CC KOSAKI Motohiro <[email protected]>
CC Kees Cook <[email protected]>

---
 kernel/sys.c |    2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.git/kernel/sys.c
===================================================================

kernel/sys.c +1 -1
@@ -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)
Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
#3 lore raw
In reply to Cyrill Gorcunov
Quoted 10 lines · Cyrill Gorcunov

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

#4 lore raw
Quoted 12 lines · Paul Bolle
Quoted 10 lines · Cyrill Gorcunov

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.

Quoted 3 lines

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