Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3572573ybi; Mon, 10 Jun 2019 12:35:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzex0by/ny/N22wIOz9yZAdNSaPgjUllZXleudKWyf4TVoacktlCdbB4QKBJ5XNo9y5+ZT X-Received: by 2002:a63:295:: with SMTP id 143mr16364660pgc.279.1560195303503; Mon, 10 Jun 2019 12:35:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560195303; cv=none; d=google.com; s=arc-20160816; b=v1hdu3WHS4keoGni6iF/UttACs8u1ULNRMxddZSimMlxMULO0t+mE0AubEMWdqGm7f 9S8zQpQFBuEbcxeTl0cm/HLYIawE6Kl8VrhEabSGG4xHlZSoeKasRXw34RaoZ3F1ZtnD mBo2TGGXxMD/baS/Dg/zWs75jlth4BtIFfKmNCS70FDEiXJe6DEBJbWOayEGrcCAbzi9 CpISWkjl64qGbVGFTTcE4X/iWP4JCRDvj6mMQJ8gDBuretvae24QyqVmUEI6ty6X+GG+ MI0JAEc2YIEAXZypn+sK2ila4ypDQa86ibzTRolIHzG47XeIVCjHdUFe2EPdnLJI5bB+ V9mw== 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=b+qTXmr9rDlJOaZB+XwzJeE/PCmE3g/ZgFKqe2gvHfw=; b=FKIDr4yVCRUCTPvvjynkK4yM7HMAQcqlUR3UnQunH18ii58zynppQufBgTzsIycBRr jsRwi4N2j8PR+xDWYU9EyVroDCvMR4Ez+APe9Z6czhZIkMMmy/BPyDq0pPTH4dkbrS9P ysAhdgk/5ly2QgNUdG04rMNUkWOjWnxjPWGRrlZtCSMeacsuzbYMGaqggoTAXN4Ia11V mjG+sjd2JXrgy56V8XwijnduA16JvRtU3hLW9pXZY6tSgV82B+ih39uYKjKGt/v3k6Ch VXr15UNHGZ4aePZ2FTONpuKBV4KPP6couFbQrSTvmLVQA6EDWj7ctDynfEUyKBW3KmMz BXIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=kEYBBdyb; 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 n7si9889954plk.435.2019.06.10.12.34.47; Mon, 10 Jun 2019 12:35:03 -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=kEYBBdyb; 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 S2389157AbfFJTeF (ORCPT + 99 others); Mon, 10 Jun 2019 15:34:05 -0400 Received: from sonic316-12.consmr.mail.gq1.yahoo.com ([98.137.69.36]:34049 "EHLO sonic316-12.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388843AbfFJTeE (ORCPT ); Mon, 10 Jun 2019 15:34:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1560195243; bh=b+qTXmr9rDlJOaZB+XwzJeE/PCmE3g/ZgFKqe2gvHfw=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=kEYBBdybysk7joQu6DpUNu26Q5TURGWUAeqLm+WKQkjtcUJQVzWIFNoCGrZhA+T3MfrcUUmEoEiMW67lnrN2lQWktXattVngUkorQQ4daCQfGvii1vb0K/AlYMYxw1SMP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WMNYrbAGzRqTp3CjXDk7L6SJtLevven7bBi93osY8 cZTHtroH7jS_CF24BbuVdeieIiWe8hMN2U5Fo0UdHWXRYhEse6YnRB5XFgpgm3ptjhtqWTI2T0Ik wPJzJnaHLIiOUB9hkrRTGEETqoZaH5dtKyL81iorHYDMRXrGUhMxqD5tnP3sbrzx35Q8FRcCc6kd rliwjpMhFVuSShg7TfiV7UAMuWGkHMR0RUxoh3KcFe60O_f6vk5Bzzn6ckgKF0P8U8k_cqqBE1Cz Bx6P17Tu0jpe5D4yyZyW9B6neyacg0q0vy5zwmxlPBVHYtIkSnTeI7Pxl7HOS6Bt4FhjzfK.IvCu RLyDmjF9990U22gnzhcIqaDZeYeHnLGvSX639z4IefrXikLkmPfs7Jk.4.UTUtg6Vx3I4bcPRYJw 2li2XZixyPKYlkKaLtajAErIS.f4DofvJKzM- Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.gq1.yahoo.com with HTTP; Mon, 10 Jun 2019 19:34:03 +0000 Received: from c-73-223-4-185.hsd1.ca.comcast.net (EHLO [192.168.0.103]) ([73.223.4.185]) by smtp431.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 769197f7c94510a94874fd97b31f197d; Mon, 10 Jun 2019 19:34:00 +0000 (UTC) Subject: Re: [RFC][PATCH 00/13] Mount, FS, Block and Keyrings notifications [ver #4] To: Andy Lutomirski Cc: Andy Lutomirski , Stephen Smalley , David Howells , Al Viro , USB list , LSM List , Greg Kroah-Hartman , raven@themaw.net, Linux FS Devel , Linux API , linux-block@vger.kernel.org, keyrings@vger.kernel.org, LKML , Paul Moore , casey@schaufler-ca.com References: <155991702981.15579.6007568669839441045.stgit@warthog.procyon.org.uk> <0cf7a49d-85f6-fba9-62ec-a378e0b76adf@schaufler-ca.com> From: Casey Schaufler Openpgp: preference=signencrypt Autocrypt: addr=casey@schaufler-ca.com; keydata= mQINBFzV9HABEAC/mmv3jeJyF7lR7QhILYg1+PeBLIMZv7KCzBSc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2QgrjDX3et2WwZFLOoOCItWxT0/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: <4b7d02b2-2434-8a7c-66cc-7dbebc37efbc@schaufler-ca.com> Date: Mon, 10 Jun 2019 12:33:59 -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/10/2019 11:22 AM, Andy Lutomirski wrote: >> On Jun 10, 2019, at 11:01 AM, Casey Schaufler = wrote: >> >>> On 6/10/2019 9:42 AM, Andy Lutomirski wrote: >>>> On Mon, Jun 10, 2019 at 9:34 AM Casey Schaufler wrote: >>>>> On 6/10/2019 8:21 AM, Stephen Smalley wrote: >>>>>> On 6/7/19 10:17 AM, David Howells wrote: >>>>>> Hi Al, >>>>>> >>>>>> Here's a set of patches to add a general variable-length notificat= ion queue >>>>>> concept and to add sources of events for: >>>>>> >>>>>> (1) Mount topology events, such as mounting, unmounting, mount ex= piry, >>>>>> mount reconfiguration. >>>>>> >>>>>> (2) Superblock events, such as R/W<->R/O changes, quota overrun a= nd I/O >>>>>> errors (not complete yet). >>>>>> >>>>>> (3) Key/keyring events, such as creating, linking and removal of = keys. >>>>>> >>>>>> (4) General device events (single common queue) including: >>>>>> >>>>>> - Block layer events, such as device errors >>>>>> >>>>>> - USB subsystem events, such as device/bus attach/remove, dev= ice >>>>>> reset, device errors. >>>>>> >>>>>> One of the reasons for this is so that we can remove the issue of = processes >>>>>> having to repeatedly and regularly scan /proc/mounts, which has pr= oven to >>>>>> be a system performance problem. To further aid this, the fsinfo(= ) syscall >>>>>> on which this patch series depends, provides a way to access super= block and >>>>>> mount information in binary form without the need to parse /proc/m= ounts. >>>>>> >>>>>> >>>>>> LSM support is included, but controversial: >>>>>> >>>>>> (1) The creds of the process that did the fput() that reduced the= refcount >>>>>> to zero are cached in the file struct. >>>>>> >>>>>> (2) __fput() overrides the current creds with the creds from (1) = whilst >>>>>> doing the cleanup, thereby making sure that the creds seen by= the >>>>>> destruction notification generated by mntput() appears to com= e from >>>>>> the last fputter. >>>>>> >>>>>> (3) security_post_notification() is called for each queue that we= might >>>>>> want to post a notification into, thereby allowing the LSM to= prevent >>>>>> covert communications. >>>>>> >>>>>> (?) Do I need to add security_set_watch(), say, to rule on whethe= r a watch >>>>>> may be set in the first place? I might need to add a variant= per >>>>>> watch-type. >>>>>> >>>>>> (?) Do I really need to keep track of the process creds in which = an >>>>>> implicit object destruction happened? For example, imagine y= ou create >>>>>> an fd with fsopen()/fsmount(). It is marked to dissolve the = mount it >>>>>> refers to on close unless move_mount() clears that flag. Now= , imagine >>>>>> someone looking at that fd through procfs at the same time as= you exit >>>>>> due to an error. The LSM sees the destruction notification c= ome from >>>>>> the looker if they happen to do their fput() after yours. >>>>> I remain unconvinced that (1), (2), (3), and the final (?) above ar= e a good idea. >>>>> >>>>> For SELinux, I would expect that one would implement a collection o= f per watch-type WATCH permission checks on the target object (or to some= well-defined object label like the kernel SID if there is no object) tha= t allow receipt of all notifications of that watch-type for objects relat= ed to the target object, where "related to" is defined per watch-type. >>>>> >>>>> I wouldn't expect SELinux to implement security_post_notification()= at all. I can't see how one can construct a meaningful, stable policy f= or it. I'd argue that the triggering process is not posting the notifica= tion; the kernel is posting the notification and the watcher has been aut= horized to receive it. >>>> I cannot agree. There is an explicit action by a subject that result= s >>>> in information being delivered to an object. Just like a signal or a= >>>> UDP packet delivery. Smack handles this kind of thing just fine. The= >>>> internal mechanism that results in the access is irrelevant from >>>> this viewpoint. I can understand how a mechanism like SELinux that >>>> works on finer granularity might view it differently. >>> I think you really need to give an example of a coherent policy that >>> needs this. >> I keep telling you, and you keep ignoring what I say. >> >>> As it stands, your analogy seems confusing. >> It's pretty simple. I have given both the abstract >> and examples. > You gave the /dev/null example, which is inapplicable to this patchset.= That addressed an explicit objection, and pointed out an exception to a generality you had asserted, which was not true. It's also a red herring regarding the current discussion. >>> If someone >>> changes the system clock, we don't restrict who is allowed to be >>> notified (via, for example, TFD_TIMER_CANCEL_ON_SET) that the clock >>> was changed based on who changed the clock. >> That's right. The system clock is not an object that >> unprivileged processes can modify. In fact, it is not >> an object at all. If you care to look, you will see that >> Smack does nothing with the clock. > And this is different from the mount tree how? The mount tree can be modified by unprivileged users. If nothing that unprivileged users can do to the mount tree can trigger a notification you are correct, the mount tree is very like the system clock. Is that the case?=20 >>> Similarly, if someone >>> tries to receive a packet on a socket, we check whether they have the= >>> right to receive on that socket (from the endpoint in question) and, >>> if the sender is local, whether the sender can send to that socket. >>> We do not check whether the sender can send to the receiver. >> Bzzzt! Smack sure does. > This seems dubious. I=E2=80=99m still trying to get you to explain to a= non-Smack person why this makes sense. Process A sends a packet to process B. If A has access to TopSecret data and B is not allowed to see TopSecret data, the delivery should be prevented. Is that nonsensical? >>> The signal example is inapplicable. >> From a modeling viewpoint the actions are identical. > This seems incorrect to me What would be correct then? Some convoluted combination of system entities that aren't owned or controlled by any mechanism?=20 > and, I think, to most everyone else reading this. That's quite the assertion. You may even be correct. > Can you explain? > > In SELinux-ese, when you write to a file, the subject is the writer and= the object is the file. When you send a signal to a process, the object= is the target process. YES!!!!!!!!!!!! And when a process triggers a notification it is the subject and the watching process is the object! Subject =3D=3D active entity Object =3D=3D passive entity Triggering an event is, like calling kill(), an action!