Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1118615ybl; Wed, 14 Aug 2019 11:01:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFYeyRoqH1A0EicwcDUJl3d6ap0PCAGQvp1E12lKpe7tsmPOxbQypoLxHYhztJZhgNKOdi X-Received: by 2002:aa7:8746:: with SMTP id g6mr1125104pfo.191.1565805704020; Wed, 14 Aug 2019 11:01:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565805704; cv=none; d=google.com; s=arc-20160816; b=ziLZQ1H8ZlARNKvrn3LCGcxs+hW0B6gOC5xCV0qHRU/9nf9tbdFxHl8gTHg/D5adGJ 0FC2EGFl1TxweURRwL4fO5QBo4rsKCUiws9Mi4jcOzRy/jZ7lqMXSMnmU6KlYiFlXcM2 pogdDl9s5OnWTeppHCX4N2fIwuTzsOfv+hjVfb63PTm7AirsoPXprMZfXROt2uFojhVo mX2Pv3Q+KPwN6lYTOWsJQRyIqmK5bicz+Vrbt3TtuvTbIeqa5iy2O+7EQJE+yz+Ba568 DQrcfowTDJ8XTuzjRyV09NrkO44a00RIJQrTylTDOE1A3pYuO8qgOFZhF9onJwpII5oo 33ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=4zJIdbKTk4vs/Wv9Hsig8KQw0X/I2uJY9vnsIEiRGWg=; b=rWdtDXtKVXKX+vdo3awVY/X+/W2U+NRPjCM7NHxyGQo8jGM9TSpbs1ldEdiiAylfl+ BsWxO7ag1nE1p/medGzgWqr5M3ex3v5PJG/y9FP2BnmHdIggre83Sz9wcrHYFJgo7nVn YfBnadJZ5E8FvB2IYhXfJc+1p4qswO5rYl6HwFu5HYoIwuZYMqEVwyAyG2DoCSO5mThA Fft/KUKl5cfx7vThqU2pfskQaMkGTD/G4B7Hv/BIHbZIDyjNSI+Tmdn767SlxgTx9lIB KIQJNPeoLuPS1uoLpAZF4FKDX4Wf779diMxHq8k+FuP3mjNH5decMTkIwGYi2y3BzO1q LmsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6si323731plr.52.2019.08.14.11.01.28; Wed, 14 Aug 2019 11:01:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728780AbfHNSAt (ORCPT + 99 others); Wed, 14 Aug 2019 14:00:49 -0400 Received: from 216-12-86-13.cv.mvl.ntelos.net ([216.12.86.13]:47316 "EHLO brightrain.aerifal.cx" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726166AbfHNSAt (ORCPT ); Wed, 14 Aug 2019 14:00:49 -0400 Received: from dalias by brightrain.aerifal.cx with local (Exim 3.15 #2) id 1hxxZh-0005rd-00; Wed, 14 Aug 2019 18:00:41 +0000 Date: Wed, 14 Aug 2019 14:00:41 -0400 From: Rich Felker To: Linus Torvalds Cc: Christian Brauner , Oleg Nesterov , Linux List Kernel Mailing , GNU C Library , Alistair Francis , "Eric W. Biederman" , Arnd Bergmann , Adhemerval Zanella , Florian Weimer , Palmer Dabbelt , macro@wdc.com, Zong Li , Andrew Morton , Al Viro , Peter Anvin Subject: Re: [PATCH v3 1/1] waitid: Add support for waiting for the current process group Message-ID: <20190814180041.GK9017@brightrain.aerifal.cx> 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=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 14, 2019 at 10:06:19AM -0700, Linus Torvalds wrote: > On Wed, Aug 14, 2019 at 9:55 AM Rich Felker wrote: > > > > I don't think "downsides" sufficiently conveys that this is hard > > breakage of a requirement for waitpid. > > Well, let's be honest here. Who has _ever_ seen a signal handler > changing the current process group? > > In fact, the SYSV version of setpgid() takes a process ID to set it > *for somebody else*, so the signal safety is not even necessarily > relevant, since it might be racing with _another_ thread doing it > (which even the kernel side won't fix - it's just user space doing odd > things). For that case, the operations are inherently unordered with respect to each other, and assuming the interpretation that waitpid is allowed to wait on "the pgid at the time of the call" rather than at the time of child exit/status-change -- which was discussed thoroughly in the thread leading up to this patch -- there is no conformance distinction. On the other hand, with changing your own pgid from a signal handler, there is a clear observable ordering between the events. For example, if the signal handler changes the pgid and forks a child with the new pgid, waitpid for "own pgid" can be assumed to include the new child in its wait set. I agree this is not common usage, so impact of breakage is probably low, but I'd rather not have wrong/racy hacks be something we're committed to supporting indefinitely on the userspace side. > So yes - it's technically true that it's impossible to emulate > properly in user space. > > But I doubt it makes _any_ difference what-so-ever, and glibc might as > well do something like > > ret = waitid(P_PGID, 0, ..); > if (ret == -EINVAL) { do the emulation } > > which makes it work with older kernels, and has zero downside in practice. > > Hmm? It only affects RV32 anyway; other archs all have a waitpid syscall that can be used. Since there's not yet any official libc release with RV32 support and AIUI the ABI is not considered "frozen" yet, emulation doesn't seem useful here. Whatever kernel version fixes this (or some later one, if nobody gets things together on upstreaming libc support of RV32) will just become the minimum version for RV32. Rich