userns: Make the count of user namespaces per user

Add a structure that is per user and per user ns and use it to hold
the count of user namespaces.  This makes prevents one user from
creating denying service to another user by creating the maximum
number of user namespaces.

Rename the sysctl export of the maximum count from
/proc/sys/userns/max_user_namespaces to /proc/sys/user/max_user_namespaces
to reflect that the count is now per user.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
Eric W. Biederman 2016-08-08 13:54:50 -05:00
parent b376c3e1b6
commit f6b2db1a3e
4 changed files with 117 additions and 30 deletions

View file

@ -322,7 +322,7 @@ void __init fork_init(void)
init_task.signal->rlim[RLIMIT_SIGPENDING] =
init_task.signal->rlim[RLIMIT_NPROC];
init_user_ns.max_user_namespaces = max_threads;
init_user_ns.max_user_namespaces = max_threads/2;
}
int __weak arch_dup_task_struct(struct task_struct *dst,