Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7028915ybi; Wed, 5 Jun 2019 10:03:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxjKRqi/az8h8W/qN0atS9xTIKcN492qhhPCet++OAy1a5Vha9+bodmupDjDRBnnVKOYPyN X-Received: by 2002:a62:e801:: with SMTP id c1mr24134482pfi.41.1559754203216; Wed, 05 Jun 2019 10:03:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559754203; cv=none; d=google.com; s=arc-20160816; b=Aorucp1C6BVndI+iMZZqa2DZWJZHE0N12Y9HDuOa2zfgbk3DLN0Hz8Y8kXl8fdmUGA ScBgNcBcBGy+PUxfXc8bOxee4fx7lWvG/ost0jS4KhKpEPPyoNBknc6RHpYIkeB6+u/f 8ulcA8u8Oh9gc6zkcWTR1jgnyBsDw6UXvOELfvIfy+PVrPcSds5zrIMCexr5pJEwhEUu CPxJj0glHuDAij8MJ7ns4U28kcDVZ+4O3/c2fJ766arzpVuPpFmDsUvf76R8cF9vm7qj mBAIYUGkH+516N1LPTvoYHbINOSiLBqTS38bSrpsxw6GyhMOxkWwU9AhF408QrcA0H1G HQsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature; bh=Iw6G8saJS8XwfQEsaETSOJ0YcpEREEU39n8ez2O36WQ=; b=DfbeeOXMn7n34aSsNMbmuSF/dFuKQg7WApnXKNWrGPALUh+KhkNct2l2C1Gp2cTobi jykHlrrBvkjDTWi372n09Sgka0Z0Lj24iALIGsCGE6+bHmtC21MQCmSXWIIHRP2KjZRc GRJpXBog4DBmaNSn7YyFcQ7rPioKRzf6tMQZXxvBb/QaBiWpdHyKGcXflmaDDTgy2Lm4 i70W4C1zyMPR+8Llk9MNlJvU0lKnq2hIhzgaKzB7Y43xFR1537Pjn0PJyKGEKaCo5sEZ RSuYsc08QXDjgLFNPhUZSOL2z43LeyS6bgoAOoLlF8hM4DgSc0s9Rxc7e264NwACRGqs 6QWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=sMks3gOd; 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 a6si28795994pla.259.2019.06.05.10.02.55; Wed, 05 Jun 2019 10:03:23 -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=@yahoo.com header.s=s2048 header.b=sMks3gOd; 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 S1728794AbfFERBj (ORCPT + 99 others); Wed, 5 Jun 2019 13:01:39 -0400 Received: from sonic317-38.consmr.mail.ne1.yahoo.com ([66.163.184.49]:46737 "EHLO sonic317-38.consmr.mail.ne1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728774AbfFERBh (ORCPT ); Wed, 5 Jun 2019 13:01:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1559754094; bh=Iw6G8saJS8XwfQEsaETSOJ0YcpEREEU39n8ez2O36WQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=sMks3gOdn1LtawqVfEy+7zU8pO8G6U/hqnaUojM5aOFDGH+7PZ5CjjrWlFYGEDkMi9D6nThAwwQBbStwRi2jI0h5OEOCypt9V2SwTmS+Nb6u2lzK6hKEjcZr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.b4sfuwCHSL4DlNWANW2PD9ueELh6JoiVAQo0CoDHhSJrzM1bqaM_uPHA IW.olxy5Ft2gmUwSpQfFIPUfDkiiOcUH6g6x2Fx1Ri6lutXr_BNWUMBsAmcNKMDM7ah0cx9nqET6 DrN7EBbOq7E9AOzKHD4PyRTFTgQa133Hz.Qa6G_bAMk.0AyqeD1py_.onN9y0PBP.Eo0LVbUkDbZ CXSV7qq7fXPBC8MWZql6hcl34lxuSFQQCxH_gPEqwj11YDTEri_zr2nME.4kb2A.K1SPtXg3DiQY KSFQBcio5bOouUrOu1ECccHnGoemow1RkJVPwxr4uzGyztAOKobwXDCiwjnMXgioHumWoQOJwwEF xkrnBBKumimyhX0uwK7CiqqYCi7hXsI_Ei.ONq.AlKjo13DVb8Xi0FL3d_fwPb_W4N.WvC8ab4ZJ uPpjx_Kfx5TWALkq5KTDgKXhcGqNqxV_zDzWi4OXe Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.ne1.yahoo.com with HTTP; Wed, 5 Jun 2019 17:01:34 +0000 Received: from c-73-223-4-185.hsd1.ca.comcast.net (EHLO [192.168.0.103]) ([73.223.4.185]) by smtp411.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 3b81f76de5e095803bd03e36e9f0cfa7; Wed, 05 Jun 2019 17:01:30 +0000 (UTC) Subject: Re: [RFC][PATCH 0/8] Mount, FS, Block and Keyrings notifications [ver #2] To: Andy Lutomirski Cc: David Howells , Al Viro , raven@themaw.net, Linux FS Devel , Linux API , linux-block@vger.kernel.org, keyrings@vger.kernel.org, LSM List , LKML , casey@schaufler-ca.com References: <50c2ea19-6ae8-1f42-97ef-ba5c95e40475@schaufler-ca.com> <155966609977.17449.5624614375035334363.stgit@warthog.procyon.org.uk> <20192.1559724094@warthog.procyon.org.uk> From: Casey Schaufler Openpgp: preference=signencrypt Autocrypt: addr=casey@schaufler-ca.com; keydata= mQINBFzV9HABEAC/mmv3jeJyF7lR7QhILYg1+PeBLIMZ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kqnEQ9W2QgrjDX3et2WwZFLOoOCItWxT0/1QO4ikcef/E7HXQf/ij Dxf9HG2o5hOlMIAkJq/uLNMvABEBAAGJAjwEGAEIACYWIQQL720fVjJTAhDNQh44pRV8jEPI EQUCXNX0cAIbDAUJEswDAAAKCRA4pRV8jEPIEWkzEACKFUnpp+wIVHpckMfBqN8BE5dUbWJc GyQ7wXWajLtlPdw1nNw0Wrv+ob2RCT7qQlUo6GRLcvj9Fn5tR4hBvR6D3m8aR0AGHbcC62cq I7LjaSDP5j/em4oVL2SMgNTrXgE2w33JMGjAx9oBzkxmKUqprhJomPwmfDHMJ0t7y39Da724 oLPTkQDpJL1kuraM9TC5NyLe1+MyIxqM/8NujoJbWeQUgGjn9uxQAil7o/xSCjrWCP3kZDID vd5ZaHpdl8e1mTExQoKr4EWgaMjmD/a3hZ/j3KfTVNpM2cLfD/QwTMaC2fkK8ExMsz+rUl1H icmcmpptCwOSgwSpPY1Zfio6HvEJp7gmDwMgozMfwQuT9oxyFTxn1X3rn1IoYQF3P8gsziY5 qtTxy2RrgqQFm/hr8gM78RhP54UPltIE96VywviFzDZehMvuwzW//fxysIoK97Y/KBZZOQs+ /T+Bw80Pwk/dqQ8UmIt2ffHEgwCTbkSm711BejapWCfklxkMZDp16mkxSt2qZovboVjXnfuq wQ1QL4o4t1hviM7LyoflsCLnQFJh6RSBhBpKQinMJl/z0A6NYDkQi6vEGMDBWX/M2vk9Jvwa v0cEBfY3Z5oFgkh7BUORsu1V+Hn0fR/Lqq/Pyq+nTR26WzGDkolLsDr3IH0TiAVH5ZuPxyz6 abzjfg== Message-ID: <9a9406ba-eda4-e3ec-2100-9f7cf1d5c130@schaufler-ca.com> Date: Wed, 5 Jun 2019 10:01:30 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/5/2019 9:04 AM, Andy Lutomirski wrote: > On Wed, Jun 5, 2019 at 7:51 AM Casey Schaufler = wrote: >> On 6/5/2019 1:41 AM, David Howells wrote: >>> Casey Schaufler wrote: >>> >>>> I will try to explain the problem once again. If process A >>>> sends a signal (writes information) to process B the kernel >>>> checks that either process A has the same UID as process B >>>> or that process A has privilege to override that policy. >>>> Process B is passive in this access control decision, while >>>> process A is active. In the event delivery case, process A >>>> does something (e.g. modifies a keyring) that generates an >>>> event, which is then sent to process B's event buffer. >>> I think this might be the core sticking point here. It looks like tw= o >>> different situations: >>> >>> (1) A explicitly sends event to B (eg. signalling, sendmsg, etc.) >>> >>> (2) A implicitly and unknowingly sends event to B as a side effect o= f some >>> other action (eg. B has a watch for the event A did). >>> >>> The LSM treats them as the same: that is B must have MAC authorisatio= n to send >>> a message to A. >> YES! >> >> Threat is about what you can do, not what you intend to do. >> >> And it would be really great if you put some thought into what >> a rational model would be for UID based controls, too. >> >>> But there are problems with not sending the event: >>> >>> (1) B's internal state is then corrupt (or, at least, unknowingly in= valid). >> Then B is a badly written program. > Either I'm misunderstanding you or I strongly disagree. A program needs to be aware of the conditions under which it gets event, *including the possibility that it may not get an event that it's not allowed*. Do you regularly write programs that go into corrupt states if an open() fails? Or where read() returns less than the amount of data you ask for? > If B has > authority to detect a certain action, and A has authority to perform > that action, then refusing to notify B because B is somehow missing > some special authorization to be notified by A is nuts. You are hand-waving the notion of authority. You are assuming that if A can read X and B can read X that A can write B. > This is just > introducing incorrectness into the design in support of a > not-actually-helpful security idea. Where is the incorrectness? Are you seriously saying that you expect all events to be generated exactly as you think they should? Have you ever even used systemd?=20 > If I can read /proc/self/mounts, I can detect changes to my mount > namespace. Then read /proc/self/mounts! Can't you poll on an fd open on /proc/self/mounts? > Giving me a faster and nicer way to do this is fine, AS > LONG AS IT ACTUALLY WORKS. "Works" means it needs to detect all > changes. So long as "WORKS" includes maintaining the system security policy, I agree. No, I don't. We already have too many bizarre and unnatural mechanisms to address whimsical special cases. If speed is such an issue you could look at making /proc better.