From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19834 invoked by alias); 14 Aug 2019 17:02:09 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 19826 invoked by uid 89); 14 Aug 2019 17:02:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.1 spammy=async-signal, 44PM, 44pm, getpgid X-HELO: youngberry.canonical.com Date: Wed, 14 Aug 2019 17:02:00 -0000 From: Christian Brauner To: Rich Felker Cc: Oleg Nesterov , linux-kernel@vger.kernel.org, libc-alpha@sourceware.org, alistair23@gmail.com, ebiederm@xmission.com, arnd@arndb.de, torvalds@linux-foundation.org, adhemerval.zanella@linaro.org, fweimer@redhat.com, palmer@sifive.com, macro@wdc.com, zongbox@gmail.com, akpm@linux-foundation.org, viro@zeniv.linux.org.uk, hpa@zytor.com Subject: Re: [PATCH v3 1/1] waitid: Add support for waiting for the current process group Message-ID: <20190814170200.kqkygob7yo5hciau@wittgenstein> References: <20190814154400.6371-1-christian.brauner@ubuntu.com> <20190814154400.6371-2-christian.brauner@ubuntu.com> <20190814160917.GG11595@redhat.com> <20190814161517.ldbn62mulk2pmqo5@wittgenstein> <20190814163443.6odsksff4jbta7be@wittgenstein> <20190814165501.GJ9017@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190814165501.GJ9017@brightrain.aerifal.cx> User-Agent: NeoMutt/20180716 X-SW-Source: 2019-08/txt/msg00351.txt.bz2 On Wed, Aug 14, 2019 at 12:55:01PM -0400, Rich Felker wrote: > On Wed, Aug 14, 2019 at 06:34:44PM +0200, Christian Brauner wrote: > > On Wed, Aug 14, 2019 at 06:15:17PM +0200, Christian Brauner wrote: > > > On Wed, Aug 14, 2019 at 06:09:17PM +0200, Oleg Nesterov wrote: > > > > On 08/14, Christian Brauner wrote: > > > > > > > > > > and a signal could come in between the system call that > > > > > retrieved the process gorup and the call to waitid that changes the > > > > ^^^^^ > > > > > current process group. > > > > > > > > I noticed this typo only because I spent 2 minutes or more trying to > > > > understand this sentence ;) But yes, a signal handler or another thread > > > > > > I'll try to rewrite it. :) > > > > Ok, here's what I changed it to: > > > > It was recently discovered that the linux version of waitid is not a > > superset of the other wait functions because it does not include > > support for waiting for the current process group. This has two > > downsides: > > 1. An extra system call is needed to get the current process group. > > 2. After the current process group is received and before it is passed > > to waitid a signal could arrive causing the current process group to change. > > I don't think "downsides" sufficiently conveys that this is hard > breakage of a requirement for waitpid. How about something like the > following? > > "It was recently discovered that the linux version of waitid is not a > superset of the other wait functions because it does not include > support for waiting for the current process group. Userspace cannot > simply emulate this functionality with an additional getpgid syscall > due to inherent race conditions that violate the async-signal safety > requirements for waitpid." I like the rather specific example in there. How about we add that after this section like so: It was recently discovered that the linux version of waitid is not a superset of the other wait functions because it does not include support for waiting for the current process group. This has two downsides: 1. An extra system call is needed to get the current process group. 2. After the current process group is received and before it is passed to waitid a signal could arrive causing the current process group to change. Such inherent race-conditions as mentioned in 2. make it impossible for userspace to emulate this functionaly and thus violate the async-signal safety requirements for waitpid. Christian