Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp2669697ybb; Sat, 30 Mar 2019 10:38:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVWA3T6GIk4DJ+7m8zwdcug11xbhC4ulfPQ7y8CLNaY/6PxJuUqrcc7NLQSAdXpPsqWq0m X-Received: by 2002:a17:902:d24:: with SMTP id 33mr55248757plu.246.1553967492507; Sat, 30 Mar 2019 10:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553967492; cv=none; d=google.com; s=arc-20160816; b=tKupBGrmlDu/FgDsEO+yexZIl7o+nzEiGlnzycU+5iTa7j8Aj9QEPj2IDfH6ayNOle BUuWD+MggfBIcClUQj3kNjG3A3U6Iut8rkA7aN8Dj5TacBcOvtMD7x7fGjqwtvn55e+B 2AqZw23941riVQS7bSo5DH+Z38ab1pQf84EdwTrn4RuKX4eYLkompww0OUstryo7O3Ch 4C/bxa7aoXZzHVF0yjr1ZVUVymhSiUZWtJ5m4RMo4ZwddbMHA4uq8B8fQfF0soCX4+KF 6OR11GkpYglWYiJ2SMpwnq53ano/6EzMAMLjMEVkeeN3TL6ID3z4J2hKLHnseK3kwFN0 pzOg== 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:dkim-signature; bh=P970KdoaWOa/M6m1Hf5UxD3ug05A6bjJlWyxMz3zgw4=; b=HMhWSyyFcCS+B568zo62uEx8X/ueO3ZSa9tMOaBEBKYH6/vx7uqD001gDWvtdJbjvV yV/dsuMAXxSdq68XnFLbHtLZ2cJNb2OPu/Eq2LBK/EpNFydaHSOBVZgIifTYLm3EsKOv KYytihDkBZjf31fi3KB2vx8nhIzG0TR/MC4L6PgSWmkCkf+vUHpXSrmzRQ2mMo0NSG+S N2y6vkoFxRC9PeofOh+gGlzZsuH/9YT2sH1OXecWj7kMu4UHMvrQ4N78KvGETpHBZ6ER XDte6pLPXzxURaqLflMXLAUzt9N3p9TvKARqZJFr/9nJMOXO4fwDNDafpwbKxpd9+Poe UQQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brauner.io header.s=google header.b=Zp1oHYXQ; 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 f12si4808281plt.418.2019.03.30.10.37.56; Sat, 30 Mar 2019 10:38:12 -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=@brauner.io header.s=google header.b=Zp1oHYXQ; 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 S1730774AbfC3RhX (ORCPT + 99 others); Sat, 30 Mar 2019 13:37:23 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:46871 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730613AbfC3RhX (ORCPT ); Sat, 30 Mar 2019 13:37:23 -0400 Received: by mail-ed1-f68.google.com with SMTP id d1so4633664edd.13 for ; Sat, 30 Mar 2019 10:37:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brauner.io; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=P970KdoaWOa/M6m1Hf5UxD3ug05A6bjJlWyxMz3zgw4=; b=Zp1oHYXQVr+DizGr7O90yBtO+g+ziKgBIVeyHpG6d0R8jfO8KxfEYhnUYjzqJh9Pt1 Hto5hk2U8Ug4XxkHEvv8PqQAkVqbaLX2SjDYVD9nPvZIwIDq9idCL4ZKX2RfqD9kV59v 9SODDXvc4LUiSR6k9LPflVf5HM6x2KwnkeTLw/acBlWjhcD2W4xWUW+bm2sqO88LJlMl BXM4tW7G0NJWNa9Y5oJrS+yEa8DOmNsBfEQ9e/gLnIDbcUI8Ko5DQ/hYTO2nj3hxHniY emH915EzjH30vvzBnbOOMNNeM2NKqAbg6lc/JtFtbrOGLGBkgyff7z3JxUFgUufSPAiu 4Dpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=P970KdoaWOa/M6m1Hf5UxD3ug05A6bjJlWyxMz3zgw4=; b=GP5gJisdbLqFcp8XwY2EaYKa3LtE4pqUXVvQ6NHygdKuybo80ZAkeuAhpq3U/QbrOg uttDjH8PtQ5cMDGfjOKVfKYz1yhzhyyQoIb3jsrh0FzOoDfzfA8E5K3U34RttTBNUdG8 k4FJ9EJNWRm3fWjOnswSEJFIJtB0pOloPVT7JV58LKN5MWFZBz08s523EUMWdgbaC706 XKJo1uHPL4ur4NuY7MU6YJtkPpm42FEjIHeI9alKs66UfuZleiOFoRJbmYF/D6ecKS9Z UT5ql9ISHhHFLIHoF2YJrDsfHKC4DVp8zOIYbTtwaoO1XJflocEtC2VZrTRdSGs1Ev2i a3NA== X-Gm-Message-State: APjAAAXTlmqlOcFiuWmFAycdPwYtHLpsKDBxV+ZEaUF6I65MV/uSSkM1 zy2qHqGVMxu/L/LHhlR1fQUuQw== X-Received: by 2002:a17:906:924e:: with SMTP id c14mr30615322ejx.230.1553967441341; Sat, 30 Mar 2019 10:37:21 -0700 (PDT) Received: from brauner.io ([2a02:8109:b6bf:d24a:b136:35b0:7c8c:280a]) by smtp.gmail.com with ESMTPSA id h33sm1488309ede.18.2019.03.30.10.37.20 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 30 Mar 2019 10:37:20 -0700 (PDT) Date: Sat, 30 Mar 2019 18:37:19 +0100 From: Christian Brauner To: Linus Torvalds Cc: Daniel Colascione , 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 , Jonathan Kowalski , "Dmitry V. Levin" , Andrew Morton , Oleg Nesterov , Nagarathnam Muthusamy , Aleksa Sarai , Al Viro , Joel Fernandes Subject: Re: [PATCH v2 0/5] pid: add pidfd_open() Message-ID: <20190330173718.hqopamhtxsq2l5bm@brauner.io> References: <20190329155425.26059-1-christian@brauner.io> <20190330171215.3yrfxwodstmgzmxy@brauner.io> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 30, 2019 at 10:24:19AM -0700, Linus Torvalds wrote: > On Sat, Mar 30, 2019 at 10:12 AM Christian Brauner wrote: > > > > > > To clarify, what the Android guys really wanted to be part of the api is > > a way to get race-free access to metadata associated with a given pidfd. > > And the idea was that *if and only if procfs is mounted* you could do: > > > > int pidfd = pidfd_open(1234, 0); > > > > int procfd = open("/proc", O_RDONLY | O_CLOEXEC); > > int procpidfd = ioctl(pidfd, PIDFD_TO_PROCFD, procfd); > > And my claim is that this is three system calls - one of them very > hacky - to just do > > int pidfd = open("/proc/%d", O_PATH); > > and you're done. It acts as the pidfd _and_ the way to get the > associated status files etc. > > So there is absolutely zero advantage to going through pidfd_open(). > > No. No. No. > > So the *only* reason for "pidfd_open()" is if you don't have /proc in > the first place. In which case the whole PIDFD_TO_PROCFD is bogus. > > Yeah, yeah, if you want to avoid going through the pathname > translation, that's one thing, but if that's your aim, then you again > should also just admit that PIDFD_TO_PROCFD is disgusting and wrong, > and you're basically saying "ok, I'm not going to do /proc at all". > > So I'm ok with the whole "simpler, faster, no-proc pidfd", but then it Understood. > really has to be *SIMPLER* and *NO PROCFS*. > > PIDFD_TO_PROCFD violates *everything*.