prctl: Use CAP_SYS_RESOUCE for PR_SET_MM option
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.
--- kernel/sys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sys.c +1 -1
@@ -1712,7 +1712,7 @@ static int prctl_set_mm(int opt, unsigneif (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 )
Quoted 28 lines · Cyrill Gorcunov
CAP_SYS_ADMINis already overloaded left and right, so to have more finegrained access control useCAP_SYS_RESOUCEhere.The
CAP_SYS_RESOUCEis 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 <[email protected]>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]>Signed-off-by Cyrill Gorcunov <[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
Quoted 10 lines · Cyrill Gorcunov
CAP_SYS_ADMINis already overloaded left and right, so to have more finegrained access control useCAP_SYS_RESOUCEhere.The
CAP_SYS_RESOUCEis 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
Suggested-by Michael Kerrisk <[email protected]>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]>Signed-off-by Cyrill Gorcunov <[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/
Quoted 10 lines · Cyrill Gorcunov
CAP_SYS_ADMINis already overloaded left and right, so to have more finegrained access control useCAP_SYS_RESOUCEhere.The
CAP_SYS_RESOUCEis 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
Quoted 12 lines · Paul Bolle
Quoted 10 lines · Cyrill Gorcunov
CAP_SYS_ADMINis already overloaded left and right, so to have more finegrained access control useCAP_SYS_RESOUCEhere.The
CAP_SYS_RESOUCEis 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