Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp853743img; Wed, 20 Mar 2019 12:16:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzx8SV4pEETfauhXV9PcTcqAberV0ZHaaUZ9VPtsQpy43UPb+zboszfMVD/neEhEYUsMjlK X-Received: by 2002:a63:3fc8:: with SMTP id m191mr8940728pga.240.1553109390220; Wed, 20 Mar 2019 12:16:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553109390; cv=none; d=google.com; s=arc-20160816; b=fKMB+WtRBsZ+m1y8tWc6GoIYRJ3Iw8QqocwpQsf/rba5++B0vLlUmlH4GSdupzu/gB 7+0aOJIIqvABJAQviX18Fc8j/+X9GxNUiJG3+6PX1OLUnjj5tTbDyDEE8qcD6QQUwaLE HSwqUc2fJwqMYIbqbxa8w3GkksX7uftYo8bgQYMAVM10N66Y1oZTdh1pgRLljQM4OkNp 33YrVX59n9CpzPZ/TZ4xjLE4OWc0DFo8Ifvm5iLbtyuVy3GP5WFus1YG1TOvqRhwqDV2 +u81ik40DI0q/8wYT61Vf16peJYXdbqLP8G0PKB3I1cESQ2vmlvAVrCy3HuwFPPRyKge oHbw== 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=BAW01zqy6KxlVMaU5EuHvmflo6RBzBcSay2jwpmFxtM=; b=bVzkspNRlkmzJUOA5aaEjDj9Muzya7Ki5YwL9dfxOzam/sNRL/yOcfKSIo4ALHfnHo ASLD3hgxg9ky6J6/kRdyBrE9iVdYnphtEs2hZ+HIZTp/G4JB/iMFS0HqJJWvvF1DnJIo 7KSkF2A8G3JII3107nsCdKE7aVtgEUsug1ppGeGnbVnhYXw6PkIFtoIUVH19BUQ6wHZI OpDjQLiR0pNWCC3uR+ljjWhmfacbWaQLzmobZDDZ4bhSr8m5PQeMT9q6o0+XnGdcovJY BmFgAL7CN0wtMG9FmR/inxm3aVDuJ158QNbnXvKe2+o6ZyT1Ev4tDz58g1Z1y+pc4OfZ JMnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brauner.io header.s=google header.b=S90Arcuj; 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 a90si2574706pla.401.2019.03.20.12.16.14; Wed, 20 Mar 2019 12:16: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=@brauner.io header.s=google header.b=S90Arcuj; 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 S1727307AbfCTTOR (ORCPT + 99 others); Wed, 20 Mar 2019 15:14:17 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:46798 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726403AbfCTTOR (ORCPT ); Wed, 20 Mar 2019 15:14:17 -0400 Received: by mail-pf1-f193.google.com with SMTP id 9so2356404pfj.13 for ; Wed, 20 Mar 2019 12:14:17 -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=BAW01zqy6KxlVMaU5EuHvmflo6RBzBcSay2jwpmFxtM=; b=S90ArcujnR16oCFASCAbzc3HMSYpIwOPCx6A18mUDzw3qdn1BrQGMBKxn9nTiPbL0p URb900dK+UL3rEr7NralddzqkDFVdKKIzsmkdkILPwMx8IuDdvGOhXyTGchBEbYOtJt+ k0mWH6EagWlUrglzpB9aH1Dt1Z0X+6yAPg30bfK+JdDCUyEXBiKgAu8071nRWRYieKYo 3xkflEgOoWgK4lavxsYpQgMnnWunMKt+hkb9x3/Jjahi0wrC9Kup2IdAvy/yHm89UyYW tpyyoMvz7ccHf1DuzBvZbYYO/jdF7ZDjSHC9dqSSbdtjtV45bjTFd3pS7H7jRAWt4a5S OQSA== 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=BAW01zqy6KxlVMaU5EuHvmflo6RBzBcSay2jwpmFxtM=; b=S+3ex/WGQjK88FJ2KpR2FfjXivbD2EmX/pnIgIxwiylDCGWSkYkf4tMSvKDgUmTqMk OUi35Ge9PcSTTqn7K15IBLEJ7Xj/xb4U2+L7olfQmA1TdilX7/+dmEnFPbHN0uLOMPpg xY3xxHmjO0QJ3RN3J8OJ77JBqZhJe5LfEHwCe/Vo2pYcVJqD0mJJEUMwtJdapd2FTGdh UsmZkRMeKh2eOdWTTDVeIAPL4Ju5qR5aLcgOgDYA0fHHzwhqE/fDgVAFdqgIh34e7cN4 TqdReMtmIFOQnLT1pmHlEPbuyJeaMu7200z50QJYD49jXYu9gawTRWVBQm4znjb2Ch/2 kK2g== X-Gm-Message-State: APjAAAU1LclvSYKg44BPGldPAwLh42VNZt+wcbaYQT6JEhEkP38zxSFx ySKkXDPPC8aq8AX82Bx+yMs9qQ== X-Received: by 2002:a63:181a:: with SMTP id y26mr9038768pgl.268.1553109256447; Wed, 20 Mar 2019 12:14:16 -0700 (PDT) Received: from brauner.io ([12.25.160.29]) by smtp.gmail.com with ESMTPSA id h3sm5563561pfb.31.2019.03.20.12.14.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Mar 2019 12:14:15 -0700 (PDT) Date: Wed, 20 Mar 2019 20:14:14 +0100 From: Christian Brauner To: Andy Lutomirski Cc: Daniel Colascione , Joel Fernandes , Suren Baghdasaryan , Steven Rostedt , Sultan Alsawaf , Tim Murray , Michal Hocko , Greg Kroah-Hartman , Arve =?utf-8?B?SGrDuG5uZXbDpWc=?= , Todd Kjos , Martijn Coenen , Ingo Molnar , Peter Zijlstra , LKML , "open list:ANDROID DRIVERS" , linux-mm , kernel-team , Oleg Nesterov , "Serge E. Hallyn" , Kees Cook Subject: Re: pidfd design Message-ID: <20190320191412.5ykyast3rgotz3nu@brauner.io> References: <20190319231020.tdcttojlbmx57gke@brauner.io> <20190320015249.GC129907@google.com> <20190320035953.mnhax3vd47ya4zzm@brauner.io> <4A06C5BB-9171-4E70-BE31-9574B4083A9F@joelfernandes.org> <20190320182649.spryp5uaeiaxijum@brauner.io> <20190320185156.7bq775vvtsxqlzfn@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 Wed, Mar 20, 2019 at 11:58:57AM -0700, Andy Lutomirski wrote: > On Wed, Mar 20, 2019 at 11:52 AM Christian Brauner wrote: > > > > You're misunderstanding. Again, I said in my previous mails it should > > accept pidfds optionally as arguments, yes. But I don't want it to > > return the status fds that you previously wanted pidfd_wait() to return. > > I really want to see Joel's pidfd_wait() patchset and have more people > > review the actual code. > > Just to make sure that no one is forgetting a material security consideration: Andy, thanks for commenting! > > $ ls /proc/self > attr exe mountinfo projid_map status > autogroup fd mounts root syscall > auxv fdinfo mountstats sched task > cgroup gid_map net schedstat timers > clear_refs io ns sessionid timerslack_ns > cmdline latency numa_maps setgroups uid_map > comm limits oom_adj smaps wchan > coredump_filter loginuid oom_score smaps_rollup > cpuset map_files oom_score_adj stack > cwd maps pagemap stat > environ mem personality statm > > A bunch of this stuff makes sense to make accessible through a syscall > interface that we expect to be used even in sandboxes. But a bunch of > it does not. For example, *_map, mounts, mountstats, and net are all > namespace-wide things that certain policies expect to be unavailable. > stack, for example, is a potential attack surface. Etc. > > As it stands, if you create a fresh userns and mountns and try to > mount /proc, there are some really awful and hideous rules that are > checked for security reasons. All these new APIs either need to > return something more restrictive than a proc dirfd or they need to > follow the same rules. And I'm afraid that the latter may be a > nonstarter if you expect these APIs to be used in libraries. > > Yes, this is unfortunate, but it is indeed the current situation. I > suppose that we could return magic restricted dirfds, or we could > return things that aren't dirfds and all and have some API that gives > you the dirfd associated with a procfd but only if you can see > /proc/PID. What would be your opinion to having a /proc//handle file instead of having a dirfd. Essentially, what I initially proposed at LPC. The change on what we currently have in master would be: https://gist.github.com/brauner/59eec91550c5624c9999eaebd95a70df