|author||Pavel Emelyanov <email@example.com>||2012-01-12 17:20:27 -0800|
|committer||Linus Torvalds <firstname.lastname@example.org>||2012-01-12 20:13:11 -0800|
sysctl: add the kernel.ns_last_pid control
The sysctl works on the current task's pid namespace, getting and setting its last_pid field. Writing is allowed for CAP_SYS_ADMIN-capable tasks thus making it possible to create a task with desired pid value. This ability is required badly for the checkpoint/restore in userspace. This approach suits all the parties for now. Signed-off-by: Pavel Emelyanov <email@example.com> Acked-by: Tejun Heo <firstname.lastname@example.org> Cc: Oleg Nesterov <email@example.com> Cc: Cyrill Gorcunov <firstname.lastname@example.org> Cc: "Eric W. Biederman" <email@example.com> Cc: Serge Hallyn <firstname.lastname@example.org> Signed-off-by: Andrew Morton <email@example.com> Signed-off-by: Linus Torvalds <firstname.lastname@example.org>
Diffstat (limited to 'kernel/pid.c')
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/pid.c b/kernel/pid.c
index fa5f72227e5f..ce8e00deaccb 100644
@@ -137,7 +137,9 @@ static int pid_before(int base, int a, int b)
- * We might be racing with someone else trying to set pid_ns->last_pid.
+ * We might be racing with someone else trying to set pid_ns->last_pid
+ * at the pid allocation time (there's also a sysctl for this, but racing
+ * with this one is OK, see comment in kernel/pid_namespace.c about it).
* We want the winner to have the "later" value, because if the
* "earlier" value prevails, then a pid may get reused immediately.