Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6645930ybi; Wed, 29 May 2019 10:47:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGWq127qMoRHxNX3toJ7o1K2pf39OLvKItYPHeKGhx4ldHorc0itScb/2TKz62qULgKpRy X-Received: by 2002:a17:902:2869:: with SMTP id e96mr32654515plb.203.1559152077840; Wed, 29 May 2019 10:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559152077; cv=none; d=google.com; s=arc-20160816; b=An3y8t0a3kDFJW8TUwT9tBiklVZ0EybMn95NSNmW8tPU9xHbLAIYwv2u6SiMAnShDq pv/E+q0Lr/1FoUfGScptPq1U1kD9Kxi0tnzrqB9xrUwEuz8tB2wQNZU4pXru91X6kYUg ST/kUHJfv1r4JHzDdvTkCnN3Ugdq10vjiv6X+VrAZgC3M+ABJrUk1rLFiXc7BDvOy9tX lISJ9LxwN2Z3uk2kAXzELJTBJKYCkBiQWgSSvjVesXcXXSMAv8GBTxJOl7RXMv/byf/p zA2zFAcz6FXH8CIOUC0BCg1CedbbnQcrpJmrxGxRqQ81HULDXV87fyk1hdzrl27J+2PS nBJg== 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=CbTHMjH+ST+XZigj3rLVDQnXul1VH3bCZnpgyA114MY=; b=IFuCpuDwSEA/GSHnc3SLDaqwmKUiTItGGSx4FPrgyBfTq6vY8ZeHT+77KyMOxzrtbx rBD5fQt6bdvbn7M25Av3nBROTXY4PmPb+MrNU3gXOkA5Wy9nXzkqo/D1Sio5UraHI8d7 5+rkzXoBr1U3QEu5ck4oK61Jj+9gy8wwfRsngXwSOlBDELKIwkYHwjHEabVRJRWyUS2y GnHJC6RIc2UzclQv0HpBnSX9Oi1wXojXI5wbn83MG8nJTK9xVgAOMnvDJTcsA108+H6u uM335jLAsselz+OY7PrIrEqzm/LvZgZI7PQcRaTTo0h1S8GJWJbF59v5sHeu5FzKdFxr xY2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=QII37T1Z; 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 q17si255931pll.285.2019.05.29.10.47.39; Wed, 29 May 2019 10:47:57 -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=QII37T1Z; 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 S1727298AbfE2Rqc (ORCPT + 99 others); Wed, 29 May 2019 13:46:32 -0400 Received: from sonic303-8.consmr.mail.bf2.yahoo.com ([74.6.131.47]:35137 "EHLO sonic303-8.consmr.mail.bf2.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727058AbfE2Rqb (ORCPT ); Wed, 29 May 2019 13:46:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1559151989; bh=CbTHMjH+ST+XZigj3rLVDQnXul1VH3bCZnpgyA114MY=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=QII37T1ZObtAVd8ttqra1vIxwLasAcJBJ5ma2pBpn/gWHzZPOrZpV+GDQXwdjt6tLs9N6jTXpLXKfEi1qKsqoc6tnK10TAom5AB4ysQEaV/Cc0ftHzZ6EHCg/38kwRLly+u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UqCJp46zTEu9e2Qj0JEDQHuGojaRFB1cdl2aDt91fougGu Fvr7s7q3IizFMLEJ8pFSyqeD5wu6Zkyo7.resXCXhfEn0KYsGbr3c23tHVVD1iL0THukM2RAxXw2 uAYu2gddhcZNWpk4idR24JB.jlGcpgibnFMn3HSjdJ0YfUV5Xel8RAp8X4Ps9OhvwJL9uGTydtkI h_jKsNHYqN1rXcYqwAsj9x0eFBlOhtVcrId6PyXBps9dWX9u6k6YrOKky6rslqaI3t3Sb1klzPi_ NYh7kgx3_K3SrGIJt2j3aVfCevB0Omhe584m0ruXaYRK1fo9nV_4_aC93LbecPZZLAQ1HaTO3E5q Kk1Z2TcmuwYGrJiJRlVNENMqeQ5oKxQm3QsH1cDYjXyt_FftVlpUhyF9iPtSa9YMyWdfSBent0H5 hitHjPoES8mPwWntKf_ARZzC3zHg- Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.bf2.yahoo.com with HTTP; Wed, 29 May 2019 17:46:29 +0000 Received: from c-73-223-4-185.hsd1.ca.comcast.net (EHLO [192.168.0.103]) ([73.223.4.185]) by smtp422.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 14a0212f313aaa80beda292114a9fd96; Wed, 29 May 2019 17:46:25 +0000 (UTC) Subject: Re: [PATCH 3/7] vfs: Add a mount-notification facility To: Andy Lutomirski Cc: David Howells , Jann Horn , Al Viro , raven@themaw.net, linux-fsdevel , Linux API , linux-block@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module , kernel list , casey@schaufler-ca.com References: <155905930702.7587.7100265859075976147.stgit@warthog.procyon.org.uk> <155905933492.7587.6968545866041839538.stgit@warthog.procyon.org.uk> <14347.1559127657@warthog.procyon.org.uk> <312a138c-e5b2-4bfb-b50b-40c82c55773f@schaufler-ca.com> <4552118F-BE9B-4905-BF0F-A53DC13D5A82@amacapital.net> From: Casey Schaufler Openpgp: preference=signencrypt Autocrypt: addr=casey@schaufler-ca.com; keydata= mQINBFzV9HABEAC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1q6lWwcFYth esJfk3ZPPJXuBokrFH8kqnEQ9W2QgrjDX3et2WwZFLOoOCItWxT0/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: <058f227c-71ab-a6f4-00bf-b8782b3b2956@schaufler-ca.com> Date: Wed, 29 May 2019 10:46:23 -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: <4552118F-BE9B-4905-BF0F-A53DC13D5A82@amacapital.net> 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 5/29/2019 10:13 AM, Andy Lutomirski wrote: > >> On May 29, 2019, at 8:53 AM, Casey Schaufler = wrote: >> >>> On 5/29/2019 4:00 AM, David Howells wrote: >>> Jann Horn wrote: >>> >>>>> +void post_mount_notification(struct mount *changed, >>>>> + struct mount_notification *notify) >>>>> +{ >>>>> + const struct cred *cred =3D current_cred(); >>>> This current_cred() looks bogus to me. Can't mount topology changes >>>> come from all sorts of places? For example, umount_mnt() from >>>> umount_tree() from dissolve_on_fput() from __fput(), which could >>>> happen pretty much anywhere depending on where the last reference ge= ts >>>> dropped? >>> IIRC, that's what Casey argued is the right thing to do from a securi= ty PoV. >>> Casey? >> You need to identify the credential of the subject that triggered >> the event. If it isn't current_cred(), the cred needs to be passed >> in to post_mount_notification(), or derived by some other means. > Taking a step back, why do we care who triggered the event? It seems t= o me that we should care whether the event happened and whether the *rece= iver* is permitted to know that. There are two filesystems, "dot" and "dash". I am not allowed to communicate with Fred on the system, and all precautions have been taken to ensure I cannot. Fred asks for notifications on all mount activity. I perform actions that result in notifications on "dot" and "dash". Fred receives notifications and interprets them using Morse code. This is not OK. If Wilma, who *is* allowed to communicate with Fred, does the same actions, he should be allowed to get the messages via Morse. The event is information. The information is generated as a result of my or Wilma's action. Fred is passive in this access. Fred is not "reading" the event. The event is being written to Fred. My process is the subject, and Fred's the object. Other security modelers may disagree. The models they produce are going to be *very* complicated and will introduce agents and intermediate objects to justify Fred's reception of an event as a read operation. > (And receiver means whoever subscribed, presumably, not whoever called = read() or mmap().) The receiver is the process that gets the event. There may be more than one receiver, and the receivers may have different credentials. Each needs to be checked separately. Isn't this starting to sound like the discussions on kdbus? I'm not sure if that deserves a :) or a :( but probably one of the two.