[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170512161705.GA18742@redhat.com>
Date: Fri, 12 May 2017 18:17:06 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Kirill Tkhai <ktkhai@...tuozzo.com>
Cc: mhocko@...e.com, avagin@...nvz.org, peterz@...radead.org,
linux-kernel@...r.kernel.org, rppt@...ux.vnet.ibm.com,
ebiederm@...ssion.com, luto@...nel.org, gorcunov@...nvz.org,
akpm@...ux-foundation.org, mingo@...nel.org, serge@...lyn.com
Subject: Re: [PATCH v2] pid_ns: Fix race between setns'ed fork() and
zap_pid_ns_processes()
On 05/12, Kirill Tkhai wrote:
>
--- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -1845,11 +1845,13 @@ static __latent_entropy struct task_struct *copy_process(
> */
> recalc_sigpending();
> if (signal_pending(current)) {
> - spin_unlock(¤t->sighand->siglock);
> - write_unlock_irq(&tasklist_lock);
> retval = -ERESTARTNOINTR;
> goto bad_fork_cancel_cgroup;
> }
> + if (unlikely(!(ns_of_pid(pid)->nr_hashed & PIDNS_HASH_ADDING))) {
> + retval = -ENOMEM;
> + goto bad_fork_cancel_cgroup;
> + }
>
> if (likely(p->pid)) {
> ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace);
> @@ -1907,6 +1909,8 @@ static __latent_entropy struct task_struct *copy_process(
> return p;
>
> bad_fork_cancel_cgroup:
> + spin_unlock(¤t->sighand->siglock);
> + write_unlock_irq(&tasklist_lock);
> cgroup_cancel_fork(p);
Looks good to me.
Oleg.
Powered by blists - more mailing lists