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 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:29:10 +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>
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)).
Oleg.