Re: [PATCH RFC v1] pidfd: fix a race in setting exit_state for pidfd polling

2019-07-19 Thread Christian Brauner
On July 19, 2019 6:51:20 PM GMT+02:00, Joel Fernandes wrote: >On Fri, Jul 19, 2019 at 12:27 PM Christian Brauner > wrote: >> >> On Fri, Jul 19, 2019 at 06:14:05PM +0200, Oleg Nesterov wrote: >> > it seems that I missed something else... >> > >> > On 07/17, Joel Fernandes (Google) wrote: >> > > >>

Re: [PATCH RFC v1] pidfd: fix a race in setting exit_state for pidfd polling

2019-07-19 Thread Joel Fernandes
On Fri, Jul 19, 2019 at 12:27 PM Christian Brauner wrote: > > On Fri, Jul 19, 2019 at 06:14:05PM +0200, Oleg Nesterov wrote: > > it seems that I missed something else... > > > > On 07/17, Joel Fernandes (Google) wrote: > > > > > > @@ -1156,10 +1157,11 @@ static int wait_task_zombie(struct

Re: [PATCH RFC v1] pidfd: fix a race in setting exit_state for pidfd polling

2019-07-19 Thread Suren Baghdasaryan
On Fri, Jul 19, 2019 at 9:27 AM Christian Brauner wrote: > > On Fri, Jul 19, 2019 at 06:14:05PM +0200, Oleg Nesterov wrote: > > it seems that I missed something else... > > > > On 07/17, Joel Fernandes (Google) wrote: > > > > > > @@ -1156,10 +1157,11 @@ static int wait_task_zombie(struct

Re: [PATCH RFC v1] pidfd: fix a race in setting exit_state for pidfd polling

2019-07-19 Thread Christian Brauner
On Fri, Jul 19, 2019 at 06:14:05PM +0200, Oleg Nesterov wrote: > it seems that I missed something else... > > On 07/17, Joel Fernandes (Google) wrote: > > > > @@ -1156,10 +1157,11 @@ static int wait_task_zombie(struct wait_opts *wo, > > struct task_struct *p) > > ptrace_unlink(p); >

Re: [PATCH RFC v1] pidfd: fix a race in setting exit_state for pidfd polling

2019-07-19 Thread Oleg Nesterov
it seems that I missed something else... On 07/17, Joel Fernandes (Google) wrote: > > @@ -1156,10 +1157,11 @@ static int wait_task_zombie(struct wait_opts *wo, > struct task_struct *p) > ptrace_unlink(p); > > /* If parent wants a zombie, don't release it now */ > -

Re: [PATCH RFC v1] pidfd: fix a race in setting exit_state for pidfd polling

2019-07-18 Thread Suren Baghdasaryan
On Thu, Jul 18, 2019 at 3:17 AM Christian Brauner wrote: > > On Wed, Jul 17, 2019 at 01:21:00PM -0400, Joel Fernandes wrote: > > From: Suren Baghdasaryan > > > > There is a race between reading task->exit_state in pidfd_poll and writing > > it after do_notify_parent calls do_notify_pidfd.

Re: [PATCH RFC v1] pidfd: fix a race in setting exit_state for pidfd polling

2019-07-18 Thread Oleg Nesterov
On 07/17, Joel Fernandes (Google) wrote: > > exit_notify > do_notify_parent > do_notify_pidfd > tsk->exit_state = EXIT_DEAD OOPS. Somehow I thought it sets exit_state before do_notify_parent(), I didn't even bother to verify this when I reviewed pidfd_poll()... Sorry, can't read the

Re: [PATCH RFC v1] pidfd: fix a race in setting exit_state for pidfd polling

2019-07-18 Thread Christian Brauner
On Wed, Jul 17, 2019 at 01:21:00PM -0400, Joel Fernandes wrote: > From: Suren Baghdasaryan > > There is a race between reading task->exit_state in pidfd_poll and writing > it after do_notify_parent calls do_notify_pidfd. Expected sequence of > events is: > > CPU 0CPU

Re: [PATCH RFC v1] pidfd: fix a race in setting exit_state for pidfd polling

2019-07-18 Thread Christian Brauner
On Wed, Jul 17, 2019 at 04:47:58PM -0400, Joel Fernandes wrote: > On Wed, Jul 17, 2019 at 11:09:59AM -0700, Suren Baghdasaryan wrote: > > On Wed, Jul 17, 2019 at 10:56 AM Christian Brauner > > wrote: > > > > > > On Wed, Jul 17, 2019 at 01:21:00PM -0400, Joel Fernandes wrote: > > > > From: Suren

Re: [PATCH RFC v1] pidfd: fix a race in setting exit_state for pidfd polling

2019-07-17 Thread Joel Fernandes
On Wed, Jul 17, 2019 at 07:55:57PM +0200, Christian Brauner wrote: > On Wed, Jul 17, 2019 at 01:21:00PM -0400, Joel Fernandes wrote: > > From: Suren Baghdasaryan > > > > There is a race between reading task->exit_state in pidfd_poll and writing > > it after do_notify_parent calls

Re: [PATCH RFC v1] pidfd: fix a race in setting exit_state for pidfd polling

2019-07-17 Thread Joel Fernandes
On Wed, Jul 17, 2019 at 11:09:59AM -0700, Suren Baghdasaryan wrote: > On Wed, Jul 17, 2019 at 10:56 AM Christian Brauner > wrote: > > > > On Wed, Jul 17, 2019 at 01:21:00PM -0400, Joel Fernandes wrote: > > > From: Suren Baghdasaryan > > > > > > There is a race between reading task->exit_state

Re: [PATCH RFC v1] pidfd: fix a race in setting exit_state for pidfd polling

2019-07-17 Thread Suren Baghdasaryan
On Wed, Jul 17, 2019 at 10:56 AM Christian Brauner wrote: > > On Wed, Jul 17, 2019 at 01:21:00PM -0400, Joel Fernandes wrote: > > From: Suren Baghdasaryan > > > > There is a race between reading task->exit_state in pidfd_poll and writing > > it after do_notify_parent calls do_notify_pidfd.

Re: [PATCH RFC v1] pidfd: fix a race in setting exit_state for pidfd polling

2019-07-17 Thread Christian Brauner
On Wed, Jul 17, 2019 at 01:21:00PM -0400, Joel Fernandes wrote: > From: Suren Baghdasaryan > > There is a race between reading task->exit_state in pidfd_poll and writing > it after do_notify_parent calls do_notify_pidfd. Expected sequence of > events is: > > CPU 0CPU

[PATCH RFC v1] pidfd: fix a race in setting exit_state for pidfd polling

2019-07-17 Thread Joel Fernandes (Google)
From: Suren Baghdasaryan There is a race between reading task->exit_state in pidfd_poll and writing it after do_notify_parent calls do_notify_pidfd. Expected sequence of events is: CPU 0CPU 1 exit_notify