Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3651587img; Mon, 25 Mar 2019 14:57:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJ5we3DH2ZQDX+5jpgrS6wrkTrKy6pceNlMOU2aWblDqGW5jSICeovWg1edDpYQr+0VeVf X-Received: by 2002:a17:902:d68d:: with SMTP id v13mr13562821ply.55.1553551050106; Mon, 25 Mar 2019 14:57:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553551050; cv=none; d=google.com; s=arc-20160816; b=Uq9ocxzaEZiZIREBgfzRn/9jxKG8LkArPTK1mAjuvhfpbc00wNz5lqKHBfD271cw88 NGXfd+kRg652XzwWmc3utXxKgDYnbyI5vqfFajmI51f2FCCxgnsAp4Kcm3UxDaEiqzBr Rq6rSKk/hlCKNlJHZ7G/bLn6pszKfOtUiIt/x20d8a86u9k8btMA2GeCLYjZ4Km+ZI6b 37AV2WEGtIut8T0SbJWWTlIrDVPg0GsO/BJXR1HnYlD0nyKUrDygyOB2TI+EFRwi2ZbE e1U4UJ8RBfmVId7ThgQRETySjJE/iihwZZSGj9fErxnFHhoErlVZZzt0QJTgI7RoF/IP Q6tA== 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=VEGJ5ejGA8qWSwhDIAUbXXUwBYpATKIo9SvRXHqf8B8=; b=wWe2+vGMR2d1TwSOAtTban8Qk2XWW6rhRezRMtaS9uKhNsI3f0Sk2/sLdLQ6tHA6s+ spEEcPO205REpKuGFqJ5ZmWcCWVeIFaPy+WuXRD3ZDEPCZF+9Yzz+xTikfSaBzXj+IdS VwZcjY3nalmVlsWWgzPMKGY21vvy+1hK5JyAcGEbBYXOFqaswqGGHUl+Pj6oPsTkeeA/ S1EoJjNU0o5LM1E9VSutMB7PFuPkcQTt5EefiYDPHH2YIht8KHF8jPvXgtdxpGwGxAfA o3kZ8MLB+mlDBQZ+gd4AhfdMytr3KDQFBalAHUJffv4saoPiG6eVC53bplTbIVjyu7MI smiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HPiDd5ec; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a20si14060277pgw.64.2019.03.25.14.57.15; Mon, 25 Mar 2019 14:57:30 -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=@gmail.com header.s=20161025 header.b=HPiDd5ec; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730460AbfCYVzP (ORCPT + 99 others); Mon, 25 Mar 2019 17:55:15 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:46363 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728563AbfCYVzO (ORCPT ); Mon, 25 Mar 2019 17:55:14 -0400 Received: by mail-qt1-f194.google.com with SMTP id z17so12215496qts.13; Mon, 25 Mar 2019 14:55:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VEGJ5ejGA8qWSwhDIAUbXXUwBYpATKIo9SvRXHqf8B8=; b=HPiDd5ecaXbvBaWKSliqBzjPjyqFsrkbz2VkB+FzGMfFuDwIGbMCAFqTzoUn3jYuOS dBIfzhuII1Dnn5vMBpvE8HEK7dVggRMeTIjuJlvR+tdwjwbXCx7Knv888uSn77LluNar jVTYBJPb4rUa7JeRz3J8gZDgjSPZYXAiq6a7I0EJTr25z+E7UVEZuCXCTEgDSy01PVCi XU70Yf+OEmt9Ee1iI0LttBvSlz7dwIFf57iqlGy2ou9PIdTVUlztcyIGwHmAF/f9LHG2 QqSkwe2usaKBmdHjydEQewxGCIEXnEFB4mpmlA2e9bpuvSj1aH6cCic4nf6zUWEVuwsI 9tgA== 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=VEGJ5ejGA8qWSwhDIAUbXXUwBYpATKIo9SvRXHqf8B8=; b=FwHhJeVALlf+5Gz7et4RwjZTHsWHhm+xZOlocqsmsaftJjc3DSwtKiXwgfVYFBBMyA bqqs9L3w9t374caTa0ytAQLnsQERBHYTD+WR/UDxivk6jNg1YVGU1fGC/xYU8qjh+iVJ OeAFMTISVYW6H41Huf8f9jfEUvGbMpQkdta2vOJOObzjQ1VNLZdQeygyLZjh17qz7k0i M7VAhXNhfBG/+2Ue07v7WjPerJwbZ+N3gQn6IC5j94fhLtnJY5hRq9EHDkrQaITt9Q2a jTUh99gdiC8dihAYndwD6rWQMkYxPQ40sLNP1MaDYHNZ/bxXtitymKl7bo1TzV0zLa3A ecuQ== X-Gm-Message-State: APjAAAUUSSjgM6TS3xGVHto1ytMq4JMsd8yy+FCERYFAFX3J3xZRlRUU lobBQE2RadQZMgNiBb6ZI29ICVfarqGYYZ1iNss= X-Received: by 2002:a0c:958d:: with SMTP id s13mr22039465qvs.205.1553550913597; Mon, 25 Mar 2019 14:55:13 -0700 (PDT) MIME-Version: 1.0 References: <20190325162052.28987-1-christian@brauner.io> <20190325173614.GB25975@google.com> <20190325201544.7o2kwuie3infcblp@brauner.io> <20190325211132.GA6494@google.com> <20190325214338.GA16969@google.com> In-Reply-To: <20190325214338.GA16969@google.com> From: Jonathan Kowalski Date: Mon, 25 Mar 2019 21:54:58 +0000 Message-ID: Subject: Re: [PATCH 0/4] pid: add pidctl() To: Joel Fernandes Cc: Jann Horn , Christian Brauner , Daniel Colascione , Konstantin Khlebnikov , Andy Lutomirski , David Howells , "Serge E. Hallyn" , "Eric W. Biederman" , Linux API , linux-kernel , Arnd Bergmann , Kees Cook , Alexey Dobriyan , Thomas Gleixner , Michael Kerrisk-manpages , "Dmitry V. Levin" , Andrew Morton , Oleg Nesterov , Nagarathnam Muthusamy , Aleksa Sarai , Al Viro 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 Mon, Mar 25, 2019 at 9:43 PM Joel Fernandes wrote: > > On Mon, Mar 25, 2019 at 10:19:26PM +0100, Jann Horn wrote: > > On Mon, Mar 25, 2019 at 10:11 PM Joel Fernandes wrote: > > > > But often you don't just want to wait for a single thing to happen; > > you want to wait for many things at once, and react as soon as any one > > of them happens. This is why the kernel has epoll and all the other > > "wait for event on FD" APIs. If waiting for a process isn't possible > > with fd-based APIs like epoll, users of this API have to spin up > > useless helper threads. > > This is true. I almost forgot about the polling requirement, sorry. So then a > new syscall it is.. About what to wait for, that can be a separate parameter > to pidfd_wait then. > This introduces a time window where the process changes state between "get pidfd" and "setup waitfd", it would be simpler if the pidfd itself supported .poll and on termination the exit status was made readable from the file descriptor. Further, in the clone4 patchset, there was a mechanism to autoreap such a process so that it does not interfere with waiting a process does normally. How do you intend to handle this case if anyone except the parent is wanting to *wait* on the process (a second process, without reaping, so as to not disrupt any waiting in the parent), and for things like libraries that finally can manage their own set of process when pidfd_clone is added, by excluding this process from the process's normal wait handling logic. Moreover, should anyone except the parent process be allowed to open a readable pidfd (or waitfd), without additional capabilities? > Thanks. > > - Joel >