From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 233F6C33C9E for ; Tue, 14 Jan 2020 19:21:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C425024656 for ; Tue, 14 Jan 2020 19:21:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C425024656 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ubuntu.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 40A0F8E0005; Tue, 14 Jan 2020 14:21:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3BB268E0003; Tue, 14 Jan 2020 14:21:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D1148E0005; Tue, 14 Jan 2020 14:21:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0120.hostedemail.com [216.40.44.120]) by kanga.kvack.org (Postfix) with ESMTP id 1926A8E0003 for ; Tue, 14 Jan 2020 14:21:07 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id DB2E7181AEF09 for ; Tue, 14 Jan 2020 19:21:06 +0000 (UTC) X-FDA: 76377207732.20.turn56_60f6ac6a6c907 X-HE-Tag: turn56_60f6ac6a6c907 X-Filterd-Recvd-Size: 4461 Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Tue, 14 Jan 2020 19:21:06 +0000 (UTC) Received: from ip5f5bd663.dynamic.kabel-deutschland.de ([95.91.214.99] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1irRkI-0008VU-EK; Tue, 14 Jan 2020 19:20:58 +0000 Date: Tue, 14 Jan 2020 20:20:57 +0100 From: Christian Brauner To: Daniel Colascione Cc: Minchan Kim , Kirill Tkhai , Michal Hocko , Andrew Morton , LKML , linux-mm , Linux API , oleksandr@redhat.com, Suren Baghdasaryan , Tim Murray , Sandeep Patil , Sonny Rao , Brian Geffon , Johannes Weiner , Shakeel Butt , John Dias Subject: Re: [PATCH 2/4] mm: introduce external memory hinting API Message-ID: <20200114192056.b6wi4adsps6xi4t4@wittgenstein> References: <20200110213433.94739-1-minchan@kernel.org> <20200110213433.94739-3-minchan@kernel.org> <56ea0927-ad2e-3fbd-3366-3813330f6cec@virtuozzo.com> <20200113104256.5ujbplyec2sk4onn@wittgenstein> <20200113184408.GD110363@google.com> <20200113191046.2tidyvc544zvchek@wittgenstein> <20200113204237.ew6nn4ohxu7auw3u@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jan 13, 2020 at 01:04:44PM -0800, Daniel Colascione wrote: > On Mon, Jan 13, 2020 at 12:42 PM Christian Brauner > wrote: > > > > On Mon, Jan 13, 2020 at 11:27:03AM -0800, Daniel Colascione wrote: > > > On Mon, Jan 13, 2020 at 11:10 AM Christian Brauner > > > wrote: > > > > This does not > > > > affect the permission checking you're performing here. > > > > > > Pidfds-as-capabilities sounds like a good change. Can you clarify what > > > you mean here though? Do you mean that in order to perform some > > > process-directed operation X on process Y, the pidfd passed to X must > > > have been opened with PIDFD_CAP_X *and* the process *using* the pidfds > > > must be able to perform operation X on process Y? Or do pidfds in this > > > model "carry" permissions in the same way that an ordinary file > > > descriptor "carries" the ability to write to a file if it was opened > > > with O_WRONLY even if the FD is passed to a process that couldn't > > > otherwise write to that file? Right now, pidfds are identity-only and > > > always rely on the caller's permissions. I like the capability bit > > > model because it makes pidfds more consistent with other file > > > descriptors and enabled delegation of capabilities across the system. > > > > I'm going back and forth on this. My initial implementation has it that > > you'd need both, PIDFD_FLAG/CAP_X and the process using the pidfd must > > be able to perform the operation X on process Y. The alternative becomes > > tricky for e.g. anything that requires ptrace_may_access() permissions > > such as getting an fd out from another task based on its pidfd and so > > on. > > I think the alternative is necessary though. What's the point of the > pidfd capability bits if they don't grant access? If I have a pidfd > for Y that doesn't let me do operation X, but I have ambient authority > to do Y anyway, then I can just make my own pidfd for Y and then use > that new pidfd to do X. AFAICT, pidfd capabilities only do something > when they replace ptrace_may_access and friends for access control. > Otherwise, they seem purely advisory. Am I missing something? (Sorry for the late reply. It's kinda busy atm.) Yes, I think the best option is to explore the possibility to make them act similar to open(). I'll try to post patches soon. Christian