Skip to content

userns: sysctl limits for namespaces

Eric W. Biederman containers linux-api linux-fsdevel lkml netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest10 patches 15 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10sysctl: Stop implicitly passing current into sysctl_table_root.lookupfs/proc/proc_sysctl.c include/linux/sysctl.h net/sysctl_net.c+10 -112 replies
2/10userns: Add per user namespace sysctls.include/linux/user_namespace.h kernel/user_namespace.c+94 -27 replies
3/10userns: Add a limit on the number of user namespacesinclude/linux/user_namespace.h kernel/fork.c kernel/user_namespace.c+64 -82 replies
4/10userns: Generalize the user namespace count into ucountinclude/linux/user_namespace.h kernel/fork.c kernel/user_namespace.c+70 -230 replies
5/10pidns: Add a limit on the number of pid namespacesinclude/linux/user_namespace.h kernel/pid_namespace.c kernel/user_namespace.c+20 -40 replies
6/10utsns: Add a limit on the number of uts namespacesinclude/linux/user_namespace.h kernel/user_namespace.c kernel/utsname.c+28 -50 replies
7/10ipcns: Add a limit on the number of ipc namespacesinclude/linux/user_namespace.h ipc/namespace.c kernel/user_namespace.c+33 -110 replies
8/10cgroupns: Add a limit on the number of cgroup namespacesinclude/linux/user_namespace.h kernel/cgroup.c kernel/user_namespace.c+17 -00 replies
9/10netns: Add a limit on the number of net namespacesinclude/linux/user_namespace.h kernel/user_namespace.c net/core/net_namespace.c+17 -00 replies
10/10mntns: Add a limit on the number of mount namespaces.fs/namespace.c include/linux/user_namespace.h kernel/user_namespace.c+20 -10 replies

Reviews trailers per patch

1 of 10 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchSerge HallynKees Cook
SeriesA-b A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b A-b
1/10A-b
2/10
3/10
4/10
5/10
6/10
7/10
8/10
9/10
10/10

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/10] userns: sysctl limits for namespaces

This patchset addresses two use cases:
- Implement a sane upper bound on the number of namespaces.
- Provide a way for sandboxes to limit the attack surface from namespaces.

The maximum sane case I can imagine is if every process is a fat process, so I set the maximum number of namespaces to the maximum number of threads.

I make these limits recursive and per user namespace so that a usernamespace root can reduce the limits further. If a user namespace root raises the limit the limit in the parent namespace will be honored.

I have cut this implementation to the bare minimum needed to achieve these objections.

Assuming nothing problematic shows up in the review I will add these to my user namespace tree.

These patches are also available at:
git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git for-testing

Eric W. Biederman (10):
sysctl: Stop implicitly passing current into sysctl_table_root.lookup
userns: Add per user namespace sysctls.
userns: Add a limit on the number of user namespaces
userns: Generalize the user namespace count into ucount
pidns: Add a limit on the number of pid namespaces
utsns: Add a limit on the number of uts namespaces
ipcns: Add a limit on the number of ipc namespaces
cgroupns: Add a limit on the number of cgroup namespaces
netns: Add a limit on the number of net namespaces
mntns: Add a limit on the number of mount namespaces.

 fs/namespace.c                 |  19 ++++-
 fs/proc/proc_sysctl.c          |  14 ++--
 include/linux/sysctl.h         |   3 +-
 include/linux/user_namespace.h |  40 +++++++++
 ipc/namespace.c                |  42 +++++++---
 kernel/cgroup.c                |  15 ++++
 kernel/fork.c                  |   5 ++
 kernel/pid_namespace.c         |  22 ++++-
 kernel/user_namespace.c        | 184 ++++++++++++++++++++++++++++++++++++++---
 kernel/utsname.c               |  31 +++++--
 net/core/net_namespace.c       |  15 ++++
 net/sysctl_net.c               |   4 +-
 12 files changed, 351 insertions(+), 43 deletions(-)

Eric