Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp455254yba; Mon, 1 Apr 2019 09:38:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5a2Vf5MrOzNyxCgRROQopZ/dM9FCgamr4KvYSmJyMOW6RmM1zauf/ULYnxDmFKQ8hh9Eh X-Received: by 2002:a63:1a42:: with SMTP id a2mr28839802pgm.358.1554136703915; Mon, 01 Apr 2019 09:38:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554136703; cv=none; d=google.com; s=arc-20160816; b=ezBrCwYtWXfeo4YJeGWU49Lfbv7aMPIgnee/RlxkOTERu63TNGK5QK3J8sNRbopV6t aps0J4cGSqLtB00YXSGAIQzmQWDlZetjwt+Xh/v6EBgxGUYeioWVgFgZLEefEt55M/a5 hVW6otXWjkZ73FQQdRbJ9yythl8ws5b4tsEDQNHBWU+sU/MqlCMUfs+51BBOHsku2HxD pvCiRl3LYLd7YAupvgMelt7pf2cnnqO0vq2Uy8qhujZLs/TY6n2NVoVTB8Av6Nc3DFwl QDEZ0lxVtt7STSzAuK2a9qBLOMGDNTcq+9ZSRHvlTNuJyChPNq4yb1/1fLPxW+0NX7eR AhSA== 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=L2/hei+vgqKaKtTHjgY02R0PKIHdRQxpOxoHgedAK9E=; b=CI4YXR35G0DJY4EdnyYQBVSQNNKvHAUBRvylqRCgBfXK3J8ImFPz2EbUo929By5SzU qXZ0r4iqdlChQCKIVE5dDBwfXSqLS5KNOaBme2NqaTiWQSTLZkDmst1lSuXMtpi+MCIm dMlFRF16FJg8L2esKuMuzwT4tBpnXJzmTBK7xP+LiePAvS7gicN9ASgbA+1CZen+syD6 CeJFG+PIVpuRlG+sSpP/eoRVH4Gt2giMQnpislgzSNrwxDkhh1OEnewkwB0J33ffE1XH jl3q9xlraHJZ0nWjuxzNACfTg4mTLKzhvIEomoa7UeBZu2O3XT18Ha3UZK+XTVtmy9CN laHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="ABfnGwP/"; 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 m2si8850550pgp.463.2019.04.01.09.38.08; Mon, 01 Apr 2019 09:38:23 -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=@linux-foundation.org header.s=google header.b="ABfnGwP/"; 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 S1728660AbfDAQh0 (ORCPT + 99 others); Mon, 1 Apr 2019 12:37:26 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:40714 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728007AbfDAQh0 (ORCPT ); Mon, 1 Apr 2019 12:37:26 -0400 Received: by mail-lj1-f195.google.com with SMTP id q66so8798540ljq.7 for ; Mon, 01 Apr 2019 09:37:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=L2/hei+vgqKaKtTHjgY02R0PKIHdRQxpOxoHgedAK9E=; b=ABfnGwP/pRA2TzpAMPGT68+v5gOV5AsgcMpu2qkb/KkfzfuZSWFRd4Vo38qjgI+Xcu vsRyPeQt/6P0JIbssE3tupmndGvmtBdLbjuG/sbB2H1crfNf4Rqs24a7nMmyWBAto/ds taZmLrriDkaFPX9iOqydhmqyPgoqNiUTFhrIs= 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=L2/hei+vgqKaKtTHjgY02R0PKIHdRQxpOxoHgedAK9E=; b=pQP9GIMUaqNPKGaVGBh+8qBN89PYN6WKmuHk+wuhEeSh+W8FKp1NOVKcwL1wO6vplk zs2ZuNMwrTji9QbORzQnh30mMcXz6ZYyMQd6I6A/YS53f8CoocHv0h8j7XAJkQEep9f9 yN/nZ+PNX56Bqoe3V+9RnryXIY6S5Ndf5spVFz2sMLNImnRdT4EYNMO0N32f2K4UlFJO 9eT0a9tl0BRJCem5NCGVHlnEZrn312IVS7U8Po50o0ZP3t2TCZD8t8cLpjIG9AXk+uil 4FomzNLs+TDFs/9sWFK+uotzLuTNqBBfI4qOl7hFMYCeUmoH/DCQokU1AcoKw9/ZD3mg ydzw== X-Gm-Message-State: APjAAAV1s1Z03IB7zmPEuDakMCU5tjSlcK6oBmc3PUMQjATm1TYxfYW1 jhKlUbYo41BJPD0ty3LaJxMUHREs0oc= X-Received: by 2002:a2e:8ece:: with SMTP id e14mr21562069ljl.66.1554136643938; Mon, 01 Apr 2019 09:37:23 -0700 (PDT) Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com. [209.85.167.51]) by smtp.gmail.com with ESMTPSA id s16sm1017453lji.61.2019.04.01.09.37.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 09:37:23 -0700 (PDT) Received: by mail-lf1-f51.google.com with SMTP id a28so6780845lfo.7 for ; Mon, 01 Apr 2019 09:37:23 -0700 (PDT) X-Received: by 2002:a19:9107:: with SMTP id t7mr33401391lfd.48.1554136212826; Mon, 01 Apr 2019 09:30:12 -0700 (PDT) MIME-Version: 1.0 References: <20190330171215.3yrfxwodstmgzmxy@brauner.io> <132107F4-F56B-4D6E-9E00-A6F7C092E6BD@amacapital.net> <20190331211041.vht7dnqg4e4bilr2@brauner.io> <18C7FCB9-2CBA-4237-94BB-9C4395A2106B@amacapital.net> <20190401114059.7gdsvcqyoz2o5bbz@yavin> In-Reply-To: From: Linus Torvalds Date: Mon, 1 Apr 2019 09:29:56 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 0/5] pid: add pidfd_open() To: Daniel Colascione Cc: Jonathan Kowalski , Aleksa Sarai , Andy Lutomirski , Christian Brauner , Jann Horn , Andrew Lutomirski , David Howells , "Serge E. Hallyn" , Linux API , Linux List Kernel Mailing , Arnd Bergmann , "Eric W. Biederman" , Konstantin Khlebnikov , Kees Cook , Alexey Dobriyan , Thomas Gleixner , Michael Kerrisk-manpages , "Dmitry V. Levin" , Andrew Morton , Oleg Nesterov , Nagarathnam Muthusamy , Al Viro , Joel Fernandes 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, Apr 1, 2019 at 9:22 AM Daniel Colascione wrote: > > There's a subtlety: suppose I'm a library and I want to create a > private subprocess. I use the new clone facility, whatever it is, and > get a pidfd back. I need to be able to read the child's exit status > even if the child exits before clone returns in the parent. Doesn't > this requirement imply that the pidfd, kernel-side, contain something > a bit more than a struct pid? Note that clone() has always supported this, but it has basically never been used. One of the early thinkings behind clone() was that it could be used for basically "AIO in user space", by having exactly these kinds of library-private internal subthreads that are hidden as real threads. It's why we have that special CSIGNAL mask for setting the exit signal. It doesn't *just* set the signal to be sent when the thread exits - setting the signal to something else than SIGCHLD actually changes behavior in other ways too. In particular a non-SIGCHLD thread won't be found by a regular "waitpid()". You have to explicitly wait for it with __WCLONE (which in turn is supposed to be used with the explicit pid to be waited for). Now, none of this was ever really used. The people who wanted AIO wanted the brain-damaged POSIX kind of AIO, not something cool and clever. So I suspect the whole exit-signal thing was just used for random small per-project things. Linus