Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2296736yba; Fri, 19 Apr 2019 16:38:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0zSx9ajzNf0c8ad5BOnix80tu//bzBelu2Bn4GX4Zyf5C8gpVAM3Bb8HTSNc6lDdc8FoI X-Received: by 2002:a63:5462:: with SMTP id e34mr6433345pgm.342.1555717081362; Fri, 19 Apr 2019 16:38:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555717081; cv=none; d=google.com; s=arc-20160816; b=kfOBvrH4MxYVdgWMoTT3oA7t3/gNWEa1zZJ2TQ5JIas3UIHv80tRIbx+bPfuFXlr2c 71DmskaMcGIo7luCTL34HRHSQfq47qwVs1TZgjDKOnt5PoYC9awcqDZpTC7sQCRX1I/q GXLMJ7fOzyFZFUNwnwrBaFgXHvoP19ADd098uQECWIXKNSoDLdLX6buN/aHV5EAWkYE4 LVbdBzHb9HaUjKerOhfwF44sa/jUud08kJr+7gBJ4Z6yfOw036Jfjh/NEJsxOXJ8qq2i lrzp3UXET3iUPBkT/LAbqdPcp16BRS2jxdAGyb/ir/gd4Vp5WHb1OoDjsTG07ZbdY8JF 7WPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=++Hp+hQI2A1lbNdiR3ijME7viUSjt5MJqK0zoL6hpGs=; b=uBfWh9AzIjKNBygZI/V5/wvgN86MLyH42r4T++owehV/4x1ERviqF6/cjoaVnx776V 0OBZcot9gzAjCZ+2zmlvc/Jcmkq95kaT6tye5bpXNnrmC6YszhpYZdo0GmPTrnZZWOHR TdsjIZ6HUslUvBPgaqaw9hnhy4hUxOyB39MrQxkM23dSrJ8MoUpmm+QqCtVUBipfLJ8S 7Rs2KjkY6d9AkXuGY/Q1SLH+9lNMCObMpvvQGDa3JtKuQQnshNQJEaxBLcHtli1M+O4K P+44CIo9jxoVA3TTvOIJfwxnRgLb/lRuRMjgTjownjm7K+2gGdU//YkTol3Jn9mx+yTB VCvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=rMPM8cWY; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1si6502763pff.206.2019.04.19.16.37.46; Fri, 19 Apr 2019 16:38:01 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=rMPM8cWY; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726834AbfDSXgj (ORCPT + 99 others); Fri, 19 Apr 2019 19:36:39 -0400 Received: from mail-ua1-f68.google.com ([209.85.222.68]:35079 "EHLO mail-ua1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726088AbfDSXgi (ORCPT ); Fri, 19 Apr 2019 19:36:38 -0400 Received: by mail-ua1-f68.google.com with SMTP id a46so2157545uae.2 for ; Fri, 19 Apr 2019 16:36:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=++Hp+hQI2A1lbNdiR3ijME7viUSjt5MJqK0zoL6hpGs=; b=rMPM8cWY1AXSzGuo4F8G3XIUsErUC/EfMes/xzkWnNqw/pAJ9YoifQRn5q3yVOED52 /4fReHjdsTJQA7W6wfujd757niPnZj7a9F1okbD/up1AioZcDDq16uULa/VMIkzhtRNN tUVzVef5Gg+SHDx7fXhYyFgGy1f6IRZDyYnDvrfJhMhNuif0VmdKybINXZU6VHZzHHcp 3McBJoiFFnrahQX3YH3mwb5i0LbY7O7ZKcrdURxSWfoVp9V0Kpp5mAP6ZWqns8dwhmkx yD4+EBDUaVQhhediuKvv9tqYNzvFdh1eLIoFO3MAu9uIize0pmTf2xjm+8Bc038P/cko gJEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=++Hp+hQI2A1lbNdiR3ijME7viUSjt5MJqK0zoL6hpGs=; b=P20G+YwqDJD6tPHuAL1prhJ0p/Pgko+TEZuq7jqHZO6NOin1gZAoPxz/fk6DI9BhzR Prdgq7Kf4c0Scqcr3MSWvHXQg2rTTyfdbqFuMgIYkQt1gYqdO8AtbaMBhiuUu1AjXg7P WvCp/YGCXmkvc16hT/9bQgW97l59RJY/qS1nKaLq6I8GWCcrY01905c6gBBkEMHE7k2n ylaVu1UfKNBKrMGVRHCL5/kvtizzi37gXkMlm5Ekhpv2p+D5eBh0J9BZlPVnfyjik06p g02polcAdq2hhr9F/X4wRbJHghY1aJqA4H+cR0GXo3UYHITOQvPvUlzCGFHybCZCsA39 l0AQ== X-Gm-Message-State: APjAAAVPhOqF7oEskGWLzvYQFdrfbYpcXPrVFVrtiNq1s4Tzhr58womz XminH6rxNcfF1qWT9mcrQq2De7dFax2StUCs9Ekm8A== X-Received: by 2002:ab0:72c2:: with SMTP id g2mr3472560uap.112.1555716996563; Fri, 19 Apr 2019 16:36:36 -0700 (PDT) MIME-Version: 1.0 References: <20190416120430.GA15437@redhat.com> <20190416192051.GA184889@google.com> <20190417130940.GC32622@redhat.com> <20190419190247.GB251571@google.com> <20190419191858.iwcvqm6fihbkaata@brauner.io> <20190419194902.GE251571@google.com> <20190419212002.GB44851@google.com> In-Reply-To: From: Daniel Colascione Date: Fri, 19 Apr 2019 16:36:24 -0700 Message-ID: Subject: Re: [PATCH RFC 1/2] Add polling support to pidfd To: Linus Torvalds Cc: Christian Brauner , Joel Fernandes , Jann Horn , Oleg Nesterov , Florian Weimer , kernel list , Andy Lutomirski , Steven Rostedt , Suren Baghdasaryan , Alexey Dobriyan , Al Viro , Andrei Vagin , Andrew Morton , Arnd Bergmann , "Eric W. Biederman" , Kees Cook , linux-fsdevel , "open list:KERNEL SELFTEST FRAMEWORK" , Michal Hocko , Nadav Amit , Serge Hallyn , Shuah Khan , Stephen Rothwell , Taehee Yoo , Tejun Heo , Thomas Gleixner , kernel-team , Tycho Andersen Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 19, 2019 at 4:33 PM Linus Torvalds wrote: > > On Fri, Apr 19, 2019 at 4:20 PM Christian Brauner wrote: > > > > On Sat, Apr 20, 2019 at 1:11 AM Linus Torvalds > > wrote: > > > > > > It's also worth noting that POLLERR/POLLHUP/POLLNVAL cannot be masked > > > for "poll()". Even if you only ask for POLLIN/POLLOUT, you will always > > > get POLLERR/POLLHUP notification. That is again historical behavior, > > > and it's kind of a "you can't poll a hung up fd". But it once again > > > means that you should consider POLLHUP to be something *exceptional* > > > and final, where no further or other state changes can happen or are > > > relevant. > > > > Which kind of makes sense for process exit. So the historical behavior > > here is in our favor and having POLLIN | POLLHUP rather fitting. > > It just seems right that POLLHUP indicates "there can be > > no more state transitions". > > Note that that is *not* true of process exit. > > The final state transition isn't "exit", it is actually "process has > been reaped". That's the point where data no longer exists. FWIW, I think the exit status should be available via pidfd even after process reaping. A non-parent holder of a pidfd has no ability to control when the parent reaps the child, or even if reaping is necessary at all --- the parent could make SIGCHLD SIG_IGN. Someone trying to read exit status via a pidfd shouldn't fail to get that exit status just because he lost the race with a concurrent waitpid().