Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp2678931ybb; Sat, 30 Mar 2019 10:53:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyuR/SOV1ogOuW5hH7FN2nYW6EZRj4XesA3YOBob9W1RMiKNP8KHEmccOuGqRFQUz8HH1gr X-Received: by 2002:a63:d304:: with SMTP id b4mr39192148pgg.300.1553968421174; Sat, 30 Mar 2019 10:53:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553968421; cv=none; d=google.com; s=arc-20160816; b=RGW1CmmfEghVAPePKRyopeK4DIt10jf6v/owxeq2U+6TOWjUVOeMIYUL7QCL7ZTCZ9 tXtIOmlKMrNQTiQOMPjP6x9TMIrh3mTBqVd1i3HJPEpvQXVhobz+z1UU0+yIqrCmp43C dK5wnzF8M4wTWU82WjfzjWRWHVFEDgnwotF7sxbyOtqTj89i7qO0knazJh80GQN9ZHKT aR393QioFFFUdHoOt6ALWQ/2k9AlssNQN+Fk8ATb5xDQyrEZbK92f3r4NlTiHUJ7o/7N fB9g5PK0Q7RwqM7PSYGUTDyHnZH4ozn6GFZLyQFIFHVrfFTZk5u41fTadnME7ElMp0xX UyDQ== 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=xAk4yPdXtRjZvnK50s7Za+aZ3ueW9LuWYKGL6Jx/I+U=; b=YFpI6royiXrzbD9rmuFrwDGHxGb+ajjSBXcQ0zs0rE9BR9veIhBv6aMS1VAXi0ov+x uPmd7tQfZPhWL3VXnzUCMW95e71mjvjTH/zz53CW2NO+RNPf739HTKdnTWStJzEP+cpr gOpwhuzAr1WWZzRMFL/D8pjh/C1W5MEAbgscDOvy99GWV+ZljotN4oL+LQxO8KN7t4Ok wXnNoW4b8f6Je9bTkaDsG2eA66tc85Cqp0GU5KOKX3wUX7r2b0CC2uR1zgQWx8GYK+rk lMyqAJWEKq9O5SixFzflZzLgkEtf7jMZ2Zx1dCHl4pGia9l0hGm7PA4EG8azAMkDSEIB eSCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brauner.io header.s=google header.b=Xmv0qI3N; 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 m21si4851708pgv.453.2019.03.30.10.53.25; Sat, 30 Mar 2019 10:53:41 -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=Xmv0qI3N; 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 S1730721AbfC3Rwq (ORCPT + 99 others); Sat, 30 Mar 2019 13:52:46 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:37672 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730497AbfC3Rwq (ORCPT ); Sat, 30 Mar 2019 13:52:46 -0400 Received: by mail-ed1-f68.google.com with SMTP id v21so4699118edq.4 for ; Sat, 30 Mar 2019 10:52:45 -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=xAk4yPdXtRjZvnK50s7Za+aZ3ueW9LuWYKGL6Jx/I+U=; b=Xmv0qI3Npvw7t/5DVBbfNz9WILUtiTxlmyvMrUzHaDZ5KvwfWTlWIhQ7KQzzz0860m CtbSqDUumm1YBAi/6jOqTPeeGsy9sSp8GyUNlxQ2kQ4/OBhY7nX0B8SuF/YJ+AkWK5jZ HSqFt/r0wQSJo09tb6sIZqUWsJ/kumYbuIDi0kcjzVRQuBdSywd4hTgghSromB4ow1hY JSa57z7WGhg9DqoN890hZvswxKTiXO9V9Do9VaO5hkv3rUdMEzOj3F7OPhX8RO05xcGQ v0xyxsHv+tALwtshY9P2jYgLQGSGcdHZocTpnEcOTvTCden/xCxGDN+ygqslz1b6JTeM F/OQ== 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=xAk4yPdXtRjZvnK50s7Za+aZ3ueW9LuWYKGL6Jx/I+U=; b=ckhgUO+5sUkwb3yRxg9WnX0RtDe38sDKpjl55lq4/0Q6Ra0EFe94tclrLMxbPmuG60 Uo7hDq4+2PRenULWOpzc56J3NCr71EFEQwrdJLzfr0QP5mkOEgG8BNIdKTJZSubs29/N DPt1J2GngBhJVejRMSuN2+skOyYd8CY92dpxsW9ioJ56QwLO89BT2yn6DY8E/jg1ayrp JPRGY5rjCu7ZVfizy0WhGbnUGU6dgzGu9UVvbi1+qGMHDYvKzGnaKTrYdOvpeN0cQ+bY BaLlzLNSlkGuowX5+M+V7oGOD28LnVUTSuJh961KIW91bfMhSFOjW+PkUI9nmGXp0fBk khNA== X-Gm-Message-State: APjAAAWljhEMkoMWGyjESodNNxp9Hu3QRzFXsB68vCzMgR4LBtg2LYhp ROtyoR89zArBIP3oFv+8WWVc5g== X-Received: by 2002:a50:8818:: with SMTP id b24mr36706986edb.86.1553968364665; Sat, 30 Mar 2019 10:52:44 -0700 (PDT) Received: from brauner.io ([2a02:8109:b6bf:d24a:b136:35b0:7c8c:280a]) by smtp.gmail.com with ESMTPSA id m30sm1614604eda.84.2019.03.30.10.52.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 30 Mar 2019 10:52:44 -0700 (PDT) Date: Sat, 30 Mar 2019 18:52:42 +0100 From: Christian Brauner To: Jonathan Kowalski Cc: Linus Torvalds , 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 , "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: <20190330175241.4itdnx3tl5upzjxd@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 05:50:20PM +0000, Jonathan Kowalski wrote: > On Sat, Mar 30, 2019 at 5:24 PM 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 > > really has to be *SIMPLER* and *NO PROCFS*. > > > > (Resending because accidently it wasn't a reply-all) > > If you go with pidfd_open, that should also mean you remove the > ability to be able to use /proc/ dir fds in pidfd_send_signal. > > Otherwise the semantics are hairy: I can only pidfd_open a task > reachable from my active namespace, but somehow also be able to open a You can easily setns() to another pid namespace and get a pidfd there. That's how most namespace interactions work right now. We already had that discussion.