Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp98958ybi; Wed, 29 May 2019 17:28:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3BnVoxaJmxMXigq3nN6bHbcShgUgMFABoLDaOvEwesmSR5zqw6GusUrn/gyWHEdUnPrOg X-Received: by 2002:a63:1a5e:: with SMTP id a30mr829269pgm.433.1559176105478; Wed, 29 May 2019 17:28:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559176105; cv=none; d=google.com; s=arc-20160816; b=Ksh081VHsdq/vMUKHJycdlTDxp8hIR3Dx8vFBnDD5HrBdGKMXyu/+iKk4fVCJdPLqZ tobvGrJ1QdBpceMV/HEIt6hyi5LrdRp+hkTDvshljDWVVbnxbAo6P8HstFQKJSjGdM+b ZODbwEQsnbIDgjVaFXn3VS9S6F1x4bpt75auWtgskauxo2QZW77x9J22BThpCfh1lk5o 59Sxe4ATFKdxTnnhsL3/hJql90vv2YnStfjBah63CQQ2ZEpIGAeiEygt3dWNTeZpx5Ss /wdb3VBrDRsU+l+bfgXCHVO3BshabxAyJ5ds0RJvmKRsYE9k4TWWSqHL8IG2BQesTaSe MjMw== 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=aXNvbCL9CgLpyiwMXk+9kSv/VwIr+hk+tW0kB/4ZuWM=; b=Qy9zbZ3SPLec9pQrTodW1TT7NU5WF3qENNKMV7b8gM1kZlv5stFngSh8udMfRUVqeN 9Dgzuo4vwVCvqsnmJ3o+TxD41HiwCWcAKY2rUkB8XSKQpQ2ql+3gXHH0jmkUfEf7VRo9 2yQbJhIIT9ymry6ePpa+4El4Imc1XBg72tRbAY8GqyD74pJNCrxqxFUTFYJkpd8/HNuY 8WoCGQMLrrbI0u9daW+J1FcEGFhHNSedcY0I8CMbbawJTbpi+2eezufjXPqhsFiCa/gh GZWi6FE92GZ1QvYSfuqCbFR8sSpZ2RbGbYsTpKd1f0zMyWw40e5WOsbk7OXA8fdp69IP 2rPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=Vtwj4hE3; 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 e8si1394204plb.420.2019.05.29.17.28.07; Wed, 29 May 2019 17:28:25 -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=Vtwj4hE3; 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 S1726658AbfE2X44 (ORCPT + 99 others); Wed, 29 May 2019 19:56:56 -0400 Received: from sonic305-9.consmr.mail.bf2.yahoo.com ([74.6.133.48]:43990 "EHLO sonic305-9.consmr.mail.bf2.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726687AbfE2X4y (ORCPT ); Wed, 29 May 2019 19:56:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1559174212; bh=aXNvbCL9CgLpyiwMXk+9kSv/VwIr+hk+tW0kB/4ZuWM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=Vtwj4hE30D/hMre72EdOBscRUBPsCt48nlJn3dzlfTrGh5ND2G8mQTE5KWK4bN1BlroZIBIWXwDJyzztZ89GyZgeKl5+hkpgPpJp9cyeTZC7Wrf/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XkpBK7zYCiVCub.iDWwO6juBTeWjEEpN8jmtulkxibee.TXy_jT Q.d82D7dATuZ7XIyIkJEADGwxSWwQlevd7gSLC_PqPp_H2XIA2WcoFfxWn7Lz5OL48V.b1ajDPuO jJktjck_1__2SmZHLEizwRRu5LG4Gr4CWftYaQ57i.69CBYzfFbvKmJDWuCLmHoXZLTF0I9mmoyK cr0qwo47aC1GTtxAE4R3KDvihqMp28yabM9rvhu8UjefD4k0J2VF2c8rLv8rtKHZK9tqgBfthFQk d3AJN3JQDXT1aSl4hjfIVdE4Gm1.dV.ttXnM3EeNnevOxzHcgrkRlPgiF4xkXrQvE0PF19MMNurs _wSpkEJyY0byYAg5GZ3tZR4q6.1YL3dWWgHWsbbeBFrjUausp3ahr1CiyeKCHsVJ0qnqaTN8eXjt yO67H8YSoa2Z.m692Itca8qnHwvk9bgVK Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.bf2.yahoo.com with HTTP; Wed, 29 May 2019 23:56:52 +0000 Received: from c-73-223-4-185.hsd1.ca.comcast.net (EHLO [192.168.0.103]) ([73.223.4.185]) by smtp429.mail.bf1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID ae0153f1394f9169644b35f1cd7f33ef; Wed, 29 May 2019 23:56:49 +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> <058f227c-71ab-a6f4-00bf-b8782b3b2956@schaufler-ca.com> <2FF92095-E5B1-4811-A7F8-B7D4C32F86DD@amacapital.net> From: Casey Schaufler Openpgp: preference=signencrypt Autocrypt: addr=casey@schaufler-ca.com; keydata= mQINBFzV9HABEAC/mmv3jeJyF7lR7QhILYg1+PeBLIMZv7KCzBSc/4ZZipoWdmr77Lel/RxQ 1PrNx0UaM5r6Hj9lJmJ9eg4s/TUBSP67mTx+tsZ1RhG78/WFf9aBe8MSXxY5cu7IUwo0J/CG vdSqACKyYPV5eoTJmnMxalu8/oVUHyPnKF3eMGgE0mKOFBUMsb2pLS/enE4QyxhcZ26jeeS6 3BaqDl1aTXGowM5BHyn7s9LEU38x/y2ffdqBjd3au2YOlvZ+XUkzoclSVfSR29bomZVVyhMB h1jTmX4Ac9QjpwsxihT8KNGvOM5CeCjQyWcW/g8LfWTzOVF9lzbx6IfEZDDoDem4+ZiPsAXC SWKBKil3npdbgb8MARPes2DpuhVm8yfkJEQQmuLYv8GPiJbwHQVLZGQAPBZSAc7IidD2zbf9 XAw1/SJGe1poxOMfuSBsfKxv9ba2i8hUR+PH7gWwkMQaQ97B1yXYxVEkpG8Y4MfE5Vd3bjJU kvQ/tOBUCw5zwyIRC9+7zr1zYi/3hk+OG8OryZ5kpILBNCo+aePeAJ44znrySarUqS69tuXd a3lMPHUJJpUpIwSKQ5UuYYkWlWwENEWSefpakFAIwY4YIBkzoJ/t+XJHE1HTaJnRk6SWpeDf CreF3+LouP4njyeLEjVIMzaEpwROsw++BX5i5vTXJB+4UApTAQARAQABtChDYXNleSBTY2hh dWZsZXIgPGNhc2V5QHNjaGF1Zmxlci1jYS5jb20+iQJUBBMBCAA+FiEEC+9tH1YyUwIQzUIe OKUVfIxDyBEFAlzV9HACGwMFCRLMAwAFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQOKUV fIxDyBG6ag/6AiRl8yof47YOEVHlrmewbpnlBTaYNfJ5cZflNRKRX6t4bp1B2YV1whlDTpiL vNOwFkh+ZE0eI5M4x8Gw2Oiok+4Q5liA9PHTozQYF+Ia+qdL5Eehfb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 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <2FF92095-E5B1-4811-A7F8-B7D4C32F86DD@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 4:12 PM, Andy Lutomirski wrote: > >> On May 29, 2019, at 10:46 AM, Casey Schaufler = wrote: >> >>> 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 change= s >>>>>> 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 = gets >>>>>> dropped? >>>>> IIRC, that's what Casey argued is the right thing to do from a secu= rity 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= to me that we should care whether the event happened and whether the *re= ceiver* 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. > Under this scenario, Fred should not be allowed to enable these watches= =2E If you give yourself and Fred unconstrained access to the same FS, th= en can communicate. How are you going to determine at the time Fred tries to enable the watch= es that I am going to do something that will trigger them? I'm not saying it= isn't possible, I'm curious how you would propose doing it. If you deny Fred th= e ability to set watches because it is possible for me to trigger them, he can't us= e them to get information from Wilma, either. > >> 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. > I disagree. They=E2=80=99ll model the watch as something to prevent if = they want to restrict communication. Sorry, but that isn't sufficiently detailed to be meaningful. >>> (And receiver means whoever subscribed, presumably, not whoever calle= d 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. > I think it=E2=80=99s a bit crazy to have the same event queue with two = readers who read different things. Look at killpg(3). The process that creates the event has to be involved in the access decision. Otherwise you have an uncontrolled data channel. When the receiver reads the event queue it knows nothing about the sender, and hence cannot make the decision unless the credential of the sender is kept with the event message, and used when the receiver tries to access it. I don't think that wold work well with the mechanism as designed. =C2=A0