This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v1 1/1] waitid: Add support for waiting for the current process group
- From: Oleg Nesterov <oleg at redhat dot com>
- To: Christian Brauner <christian dot brauner at ubuntu dot com>
- Cc: linux-kernel at vger dot kernel dot org, libc-alpha at sourceware dot org, alistair23 at gmail dot com, ebiederm at xmission dot com, arnd at arndb dot de, dalias at libc dot org, torvalds at linux-foundation dot org, adhemerval dot zanella at linaro dot org, fweimer at redhat dot com, palmer at sifive dot com, macro at wdc dot com, zongbox at gmail dot com, akpm at linux-foundation dot org, viro at zeniv dot linux dot org dot uk, hpa at zytor dot com
- Date: Wed, 14 Aug 2019 14:50:12 +0200
- Subject: Re: [PATCH v1 1/1] waitid: Add support for waiting for the current process group
- References: <CAKmqyKMJPQAOKn11xepzAwXOd4e9dU0Cyz=A0T-uMEgUp5yJjA@mail.gmail.com> <20190814113822.9505-1-christian.brauner@ubuntu.com> <20190814113822.9505-2-christian.brauner@ubuntu.com> <20190814122909.GA11595@redhat.com> <20190814124551.hnt363g3blhuf2pv@wittgenstein>
On 08/14, Christian Brauner wrote:
>
> On Wed, Aug 14, 2019 at 02:29:10PM +0200, Oleg Nesterov wrote:
> > On 08/14, christian.brauner@ubuntu.com wrote:
> > >
> > > case P_PGID:
> > > type = PIDTYPE_PGID;
> > > - if (upid <= 0)
> > > + if (upid < 0)
> > > return -EINVAL;
> > > +
> > > + if (upid == 0)
> > > + pid = get_pid(task_pgrp(current));
> >
> > this needs rcu lock or tasklist_lock, this can race with another thread
> > doing sys_setpgid/setsid (see change_pid(PIDTYPE_PGID)).
>
> Oh, I naively assumed task_pgrp() would take an rcu lock...
but it would not help ;)
> though I think we should be fine with just rcu_read_lock().
Yes,
Oleg.