pid: use checkpoint_restore_ns_capable() for set_tid
authorAdrian Reber <areber@redhat.com>
Sun, 19 Jul 2020 10:04:12 +0000 (12:04 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 19 Jul 2020 18:14:42 +0000 (20:14 +0200)
Use the newly introduced capability CAP_CHECKPOINT_RESTORE to allow
using clone3() with set_tid set.

Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com>
Reviewed-by: Serge Hallyn <serge@hallyn.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Link: https://lore.kernel.org/r/20200719100418.2112740-3-areber@redhat.com
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
kernel/pid.c

index f1496b757162154ecc68440afeaadb75b346f97b..450d40469b1c208ebfce1ad8934925f7a599f9d7 100644 (file)
@@ -198,7 +198,7 @@ struct pid *alloc_pid(struct pid_namespace *ns, pid_t *set_tid,
                        if (tid != 1 && !tmp->child_reaper)
                                goto out_free;
                        retval = -EPERM;
-                       if (!ns_capable(tmp->user_ns, CAP_SYS_ADMIN))
+                       if (!checkpoint_restore_ns_capable(tmp->user_ns))
                                goto out_free;
                        set_tid_size--;
                }