Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1640565 > unrolled thread

Re: [PATCH v2] pid_ns: Fix race between setns'ed fork() and zap_pid_ns_processes()

Started byOleg Nesterov <oleg@redhat.com>
First post2017-05-12 18:20 +0200
Last post2017-05-12 19:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v2] pid_ns: Fix race between setns'ed fork() and         zap_pid_ns_processes() Oleg Nesterov <oleg@redhat.com> - 2017-05-12 18:20 +0200
    Re: [PATCH v2] pid_ns: Fix race between setns'ed fork() and zap_pid_ns_processes() ebiederm@xmission.com (Eric W. Biederman) - 2017-05-12 18:50 +0200
      Re: [PATCH v2] pid_ns: Fix race between setns'ed fork() and  zap_pid_ns_processes() Oleg Nesterov <oleg@redhat.com> - 2017-05-12 19:10 +0200

#1640565 — Re: [PATCH v2] pid_ns: Fix race between setns'ed fork() and zap_pid_ns_processes()

FromOleg Nesterov <oleg@redhat.com>
Date2017-05-12 18:20 +0200
SubjectRe: [PATCH v2] pid_ns: Fix race between setns'ed fork() and zap_pid_ns_processes()
Message-ID<tGlsl-76m-9@gated-at.bofh.it>
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(&current->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(&current->sighand->siglock);
> +	write_unlock_irq(&tasklist_lock);
>  	cgroup_cancel_fork(p);

Looks good to me.

Oleg.

[toc] | [next] | [standalone]


#1640593 — Re: [PATCH v2] pid_ns: Fix race between setns'ed fork() and zap_pid_ns_processes()

Fromebiederm@xmission.com (Eric W. Biederman)
Date2017-05-12 18:50 +0200
SubjectRe: [PATCH v2] pid_ns: Fix race between setns'ed fork() and zap_pid_ns_processes()
Message-ID<tGlVo-7jv-33@gated-at.bofh.it>
In reply to#1640565
Oleg Nesterov <oleg@redhat.com> writes:

> 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(&current->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(&current->sighand->siglock);
>> +	write_unlock_irq(&tasklist_lock);
>>  	cgroup_cancel_fork(p);
>
> Looks good to me.

Oleg can I have a review or acked by?

Then I will queue this up.
Eric

[toc] | [prev] | [next] | [standalone]


#1640622 — Re: [PATCH v2] pid_ns: Fix race between setns'ed fork() and zap_pid_ns_processes()

FromOleg Nesterov <oleg@redhat.com>
Date2017-05-12 19:10 +0200
SubjectRe: [PATCH v2] pid_ns: Fix race between setns'ed fork() and zap_pid_ns_processes()
Message-ID<tGmeK-7Jn-17@gated-at.bofh.it>
In reply to#1640593
On 05/12, Eric W. Biederman wrote:
>
> Oleg Nesterov <oleg@redhat.com> writes:
>
> > Looks good to me.
>
> Oleg can I have a review or acked by?

Sure, feel free to add

Acked-by: Oleg Nesterov <oleg@redhat.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web