Skip to content

RFC c/r: add ability to restore mm attributes in a non-root userns

Andrey Vagin lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3prctl: reduce permissions to change boundaries of data, brk and stackkernel/sys.c+17 -216 replies
2/3capabilities: add a secure bit to allow changing a task exe linkinclude/uapi/linux/securebits.h kernel/sys.c kernel/user_namespace.c +1 more+25 -21 reply
3/3prctl: allow to use PR_MM_SET_* which affect only a current taskkernel/sys.c+1 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH RFC 0/3] c/r: add ability to restore mm attributes in a non-root userns

Currently PR_SET_MM_* require the global CAP_SYS_RESOURCE, which is absent in a non-root userns.

Here are three groups of attributes:
1. PR_SET_MM_START_*_DATA, PR_SET_MM_*BRK, PR_SET_MM_*_STACK These attributes can affect resource limits, so here is no sense to restrict them if a proper limit is unlimited.
2. PR_MM_SET_EXE_FILE. We have not found other way than add a secure bit. This bit is set from a root userns and inhereted by children. Thanks to Pavel Emelyanov for the idea.
3. All other attributes don't affect other tasks or limits, so can be changed without special permissions.

Andrey Vagin (3):
prctl: reduce permissions to change boundaries of data, brk and stack
capabilities: add a secure bit to allow changing a task exe link
prctl: allow to use PR_MM_SET_* which affect only a current task

 include/uapi/linux/securebits.h |  9 ++++++++-
 kernel/sys.c                    | 21 +++++++++++++++++++--
 kernel/user_namespace.c         |  3 ++-
 security/commoncap.c            |  7 +++++++
 4 files changed, 36 insertions(+), 4 deletions(-)
Cc Andrew Morton <[email protected]>
Cc Oleg Nesterov <[email protected]>
Cc Al Viro <[email protected]>
Cc Kees Cook <[email protected]>
Cc "Eric W. Biederman" <[email protected]>
Cc Stephen Rothwell <[email protected]>
Cc Pavel Emelyanov <[email protected]>
Cc Aditya Kali <[email protected]>
Signature · 1 line
1.8.5.3