On 08/21, Oleg Nesterov wrote:
>
> Still. Can't we make a single check? Like the initial patch I sent, but
> this one moves the check into copy_process() and checks CLONE_* first.
> Looks a bit simpler. And more understandable to me but this is subjective.

Seriously. CLONE_NEWPID and task_active_pid_ns() != nsproxy->pid_ns are
the same thing in this respect. Let me send the patches for review, I
decided to split this change.

> --- x/kernel/fork.c
> +++ x/kernel/fork.c
> @@ -1173,12 +1173,13 @@ static struct task_struct *copy_process(
>               return ERR_PTR(-EINVAL);
>  
>       /*
> -      * If the new process will be in a different pid namespace
> -      * don't allow the creation of threads.
> +      * --------------  COMMENT -----------------
>        */
> -     if ((clone_flags & (CLONE_VM|CLONE_NEWPID)) &&
> -         (task_active_pid_ns(current) != current->nsproxy->pid_ns))
> -             return ERR_PTR(-EINVAL);
> +     if (clone_flags & (CLONE_SIGHAND | CLONE_PARENT)) {
> +             if ((clone_flags & (CLONE_NEWUSER | CLONE_NEWPID)) ||
> +                 (task_active_pid_ns(current) != current->nsproxy->pid_ns))
> +                     return -EINVAL;
                                ^^^^^^

should be ERR_PTR(-EINVAL)

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to