Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp737538yba; Thu, 16 May 2019 08:10:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqw706RxzK18JBf/ybzCVvW+oa2e1ucrUEsmMZ44XBrPn6lUMDmelP4T2Kv+UlMzOFMGeyiY X-Received: by 2002:a63:474c:: with SMTP id w12mr2797051pgk.152.1558019418963; Thu, 16 May 2019 08:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558019418; cv=none; d=google.com; s=arc-20160816; b=P3gvfhQz/XbKk57eErML8CvV987l4HwAeTEyBiTPg5wPIBj1N6gFLRjS3QWazXlBPb Oy3aY5kqkJcgwofOe/WCLVuvluNC27PmjNG3XkE6pSIr9ynltCVkpmWB4FGlm6lrMVK8 XXSH4kNIT1SLwTELzpztSdtBEmawpIPo4CJOzjW4XtVyqr4IJ126kFGC9p45NjMPH7cx tSYH478WtK0VlTaAcXmJMXINVschVC9AlGB+qipyHHbleqPsosl7AgwM9wK5jNAa96uf TXXumHnamsavfTuCrEHCGneLsZ1KchYbMv+JZGPsoROpkepN259Oz3BhrlUKUsUbnn8s VxsQ== 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=WIIqE36Kd1fW8zLNNfBbV6X6wkNducxGSAnU5Ph5S3M=; b=a1qzEsJIK1ivURynTxZKYVIG9o/yqtbYCRscrFRXlxzpLOGvyGLh+iEMCWNzdWseN4 MCfy1VJDa9rc3rktSfyzEl0Q734XmCEJtMeZrtrDkvs+7Zc6z0iq++4rvWS1CdD3hiBW A1uDqkNZnZ8Of1qbe8Xubap4qV/3NWJ4xMX1rHFfyS4fSOloaaAhVefEV80SZSOMUTaD 1k9f1Di7DTeT0muhF0hanJQYQAE2dq+N+SQgMrq50tLup2cANOUY0wDCTb56Jz3IDgUx 4AjL1hshDCk1k9W+n2dv8jY3gaCDWvG+RoWfyncVhbxGgSgYiCkpDKt8dPzjSD0R+YoD M5Ag== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g69si4980703pgc.408.2019.05.16.08.09.33; Thu, 16 May 2019 08:10:18 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727421AbfEPPGW (ORCPT + 99 others); Thu, 16 May 2019 11:06:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55550 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727021AbfEPPGV (ORCPT ); Thu, 16 May 2019 11:06:21 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4A40137EEB; Thu, 16 May 2019 15:06:20 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.159]) by smtp.corp.redhat.com (Postfix) with SMTP id 213925D9CD; Thu, 16 May 2019 15:06:13 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 16 May 2019 17:06:19 +0200 (CEST) Date: Thu, 16 May 2019 17:06:12 +0200 From: Oleg Nesterov To: Aleksa Sarai Cc: Christian Brauner , jannh@google.com, viro@zeniv.linux.org.uk, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, arnd@arndb.de, akpm@linux-foundation.org, dhowells@redhat.com, ebiederm@xmission.com, elena.reshetova@intel.com, keescook@chromium.org, luto@amacapital.net, luto@kernel.org, tglx@linutronix.de, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, joel@joelfernandes.org, dancol@google.com, serge@hallyn.com, Geert Uytterhoeven Subject: Re: [PATCH v1 1/2] pid: add pidfd_open() Message-ID: <20190516150611.GC22564@redhat.com> References: <20190516135944.7205-1-christian@brauner.io> <20190516142659.GB22564@redhat.com> <20190516145607.j43xyj26k6l5vmbd@yavin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190516145607.j43xyj26k6l5vmbd@yavin> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 16 May 2019 15:06:21 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/17, Aleksa Sarai wrote: > > On 2019-05-16, Oleg Nesterov wrote: > > On 05/16, Christian Brauner wrote: > > > > > > With the introduction of pidfds through CLONE_PIDFD it is possible to > > > created pidfds at process creation time. > > > > Now I am wondering why do we need CLONE_PIDFD, you can just do > > > > pid = fork(); > > pidfd_open(pid); > > While the race window would be exceptionally short, there is the > possibility that the child will die Yes, > and their pid will be recycled > before you do pidfd_open(). No. Unless the caller's sub-thread does wait() before pidfd_open(), of course. Or unless you do signal(SIGCHILD, SIG_IGN). Oleg.