Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3483090ybi; Mon, 10 Jun 2019 11:02:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCFyoPGHPik1noMMcgK+Fr9eDn1OKT3sOq/QvzIhy4TQkpCFsL4KEqO6/CVZqZFBd3UIqI X-Received: by 2002:a62:ce07:: with SMTP id y7mr47388298pfg.12.1560189749306; Mon, 10 Jun 2019 11:02:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560189749; cv=none; d=google.com; s=arc-20160816; b=MjTCJOgIKBoiKEJD4HzKIUT9enx4+gl94TI4719c55/8Y8pISTPHJmTSSWl781Ktyq aCildw69rv6SzilTv6yFgprKY/AX5I/l1hRhDV/HVUgpjUnLz9CSsg7Ivia52NObyNlj O6wzKAcEsA6jyQZIHgTQysBTM8dA7wj2udWUWMSqFIasb+yPcM2gD+Ubxn/urVuYWS6D M4V5cid3pRK7Eyp/toaZOtSSzbqcy5xmmZuyo92SGeicXOmSaJi/ejLCLzWpUz+c+tyJ wOiyNpSqTyuEwW6JjONv1fKtJgZr4om/ZjgqZR1RCxPyWgroy5YWRHWorptd5PjRJoCE LbKA== 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=lV+tKKEczHX6zGPstrNJV80uFtmTE/wxVIUJrQEbmH0=; b=KRA0Vm1XJ7iQpvYh+qnPGaBFSKBCFw9BT5xedZBRhJyz8H5htClymzCKFykH9aP9E3 dJ2N4/W+y+aiRHjg44PJFf1YT4qlDrzxbCb57H5GxQwFYwuhrSPj2FdCIv54yy2E8MaY ybjJMtyod500OKWpzLO9L60HPF1yig1rpBVIZVGTBZCg08AWImadmc0Nza3XbHJ4kIgR cfQVQGJtFG1xcsa+2KF82iZVRldJZ+pJgRI0ChXTIk4zdXh0QCK1feMFGo8pmLpFfLgh g3LRgcdqTo3QPU6YK+gTUSM+2ppUBJA5VyCKdXkU2Akt7Y0JOz1zJxt5ygZhf0MUBJ8M Q2Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=jAIDOBGn; 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 f34si10657441plf.258.2019.06.10.11.02.12; Mon, 10 Jun 2019 11:02:29 -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=jAIDOBGn; 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 S2388745AbfFJSCF (ORCPT + 99 others); Mon, 10 Jun 2019 14:02:05 -0400 Received: from sonic310-27.consmr.mail.gq1.yahoo.com ([98.137.69.153]:35895 "EHLO sonic310-27.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388052AbfFJSCF (ORCPT ); Mon, 10 Jun 2019 14:02:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1560189722; bh=lV+tKKEczHX6zGPstrNJV80uFtmTE/wxVIUJrQEbmH0=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=jAIDOBGn5rpDZZMe7xse85jH8CUvXy0nHjBp1hJBValxbx2cH1pOOCoSTAHPozHxS7THO9e6OjcqOh+E1RxHzOjwtO5xzRpdV1uQB+fya2R4nAHbncxwB+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SyG Iz_OKv5ot00yLOcv8bW.xTQVL3bnpM374ZuJLPhUjL8N925B_6bpRSxL_lCSnmKPkC8sssiA53JG xt7h6xPSDRltfd9YdJZIkPm9JPzefAICp84JL5mkIiFrU4fAKNrMxRALM9AL4wBCify0Vo0CfWHm cnuNMyLt.O5bGh7KegfFV95U6KsRPsxNYeVkwBEOpTrlUJXi6RcKrdOvQg34LxfLEpPlzWU5gwmO pvBjqNxncgv1OOm3.dI6uiAyoHO5W.g1QUI3vuCZ2dhFSxRf.5GkN.7IhT2tRo4q1whX3qlVyN8Y IN.FkcByf8a9Dy3cUzW5ERivTy8h9qYM7500Nr9pGvw_ai0rr9U17ar6KhgGprku8enNW8EPMWbu sKiA8JoIDI8OBKqW5AyqRPLViCbKOc_06bS6zVBWojJL9mnCgcMAYToTmhve2CBnMp2iZN_zrNAN ceDN5LE8LXbsUxBExMQMZLT2AEUKVdvnkh_ha Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.gq1.yahoo.com with HTTP; Mon, 10 Jun 2019 18:02:02 +0000 Received: from c-73-223-4-185.hsd1.ca.comcast.net (EHLO [192.168.0.103]) ([73.223.4.185]) by smtp429.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID fb4873ed39895ada10e7258b0b9ef7c7; Mon, 10 Jun 2019 18:01:59 +0000 (UTC) Subject: Re: [RFC][PATCH 00/13] Mount, FS, Block and Keyrings notifications [ver #4] To: Andy Lutomirski Cc: 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/mmv3jeJyF7l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fk3ZPPJXuBokrFH8kqnEQ9W2QgrjDX3et2WwZFLOoOCItWxT0/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: Date: Mon, 10 Jun 2019 11:01:58 -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 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 notificatio= n queue >>>> concept and to add sources of events for: >>>> >>>> (1) Mount topology events, such as mounting, unmounting, mount exp= iry, >>>> mount reconfiguration. >>>> >>>> (2) Superblock events, such as R/W<->R/O changes, quota overrun an= d I/O >>>> errors (not complete yet). >>>> >>>> (3) Key/keyring events, such as creating, linking and removal of k= eys. >>>> >>>> (4) General device events (single common queue) including: >>>> >>>> - Block layer events, such as device errors >>>> >>>> - USB subsystem events, such as device/bus attach/remove, devi= ce >>>> reset, device errors. >>>> >>>> One of the reasons for this is so that we can remove the issue of pr= ocesses >>>> having to repeatedly and regularly scan /proc/mounts, which has prov= en to >>>> be a system performance problem. To further aid this, the fsinfo() = syscall >>>> on which this patch series depends, provides a way to access superbl= ock and >>>> mount information in binary form without the need to parse /proc/mou= nts. >>>> >>>> >>>> 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) w= hilst >>>> doing the cleanup, thereby making sure that the creds seen by = the >>>> destruction notification generated by mntput() appears to come= 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 whether= 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 a= n >>>> implicit object destruction happened? For example, imagine yo= u create >>>> an fd with fsopen()/fsmount(). It is marked to dissolve the m= ount 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 co= me from >>>> the looker if they happen to do their fput() after yours. >>> I remain unconvinced that (1), (2), (3), and the final (?) above are = a good idea. >>> >>> For SELinux, I would expect that one would implement a collection of = per watch-type WATCH permission checks on the target object (or to some w= ell-defined object label like the kernel SID if there is no object) that = allow receipt of all notifications of that watch-type for objects related= to the target object, where "related to" is defined per watch-type. >>> >>> I wouldn't expect SELinux to implement security_post_notification() a= t all. I can't see how one can construct a meaningful, stable policy for= it. I'd argue that the triggering process is not posting the notificati= on; the kernel is posting the notification and the watcher has been autho= rized to receive it. >> I cannot agree. There is an explicit action by a subject that results >> 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. > 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. > 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. > The signal example is inapplicable. =46rom a modeling viewpoint the actions are identical. > Sending a signal to a process is > an explicit action done to that process, and it can easily adversely > affect the target. Of course it requires permission. > > --Andy