Skip to content

Commit d385c8b

Browse files
Werkovbrauner
authored andcommitted
pid: Do not set pid_max in new pid namespaces
It is already difficult for users to troubleshoot which of multiple pid limits restricts their workload. The per-(hierarchical-)NS pid_max would contribute to the confusion. Also, the implementation copies the limit upon creation from parent, this pattern showed cumbersome with some attributes in legacy cgroup controllers -- it's subject to race condition between parent's limit modification and children creation and once copied it must be changed in the descendant. Let's do what other places do (ucounts or cgroup limits) -- create new pid namespaces without any limit at all. The global limit (actually any ancestor's limit) is still effectively in place, we avoid the set/unshare race and bumps of global (ancestral) limit have the desired effect on pid namespace that do not care. Link: https://lore.kernel.org/r/[email protected]/ Link: https://lore.kernel.org/r/[email protected]/ Fixes: 7863dcc ("pid: allow pid_max to be set per pid namespace") Signed-off-by: Michal Koutný <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent 50dc696 commit d385c8b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/pid_namespace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static struct pid_namespace *create_pid_namespace(struct user_namespace *user_ns
107107
goto out_free_idr;
108108
ns->ns.ops = &pidns_operations;
109109

110-
ns->pid_max = parent_pid_ns->pid_max;
110+
ns->pid_max = PID_MAX_LIMIT;
111111
err = register_pidns_sysctls(ns);
112112
if (err)
113113
goto out_free_inum;

0 commit comments

Comments
 (0)