Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4493384ybi; Tue, 11 Jun 2019 07:33:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzSkhuf1tMK3tX1ruT8GecHV3RTKcvO1FG4VgUAMw5OcCTSjDPSWdo43GbmULyOFiMPL5gR X-Received: by 2002:a17:902:8bca:: with SMTP id r10mr21813918plo.4.1560263592493; Tue, 11 Jun 2019 07:33:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560263592; cv=none; d=google.com; s=arc-20160816; b=otWmSZWKtcMFcGAqymFWmvEllNkQeaAYj/Tj0xgv+Wv8/zeQuC9csQpbroYsrEyvOO G6ZF62uDlxMdG0vmgHj9nT4KxCeql9ezLMU6DBt9i0ycs0gOHh/msIxGP4dr6kzGIX5x bCd6lORJ1g29dldFoGdWQSc7F5OvaVh1Ypp0C8NOzvru//6/bU+urP584da2atpiGYUQ oPvEGWgC9/e9+9zULSBRMVq8Tsmyq6V73ADomoRM2zsmfdzw63hA1v9KNgOk3+tBv//N LbhAAV/1iioJGzzpb79OoSMcSw4GM6KoToSNNKolSUAEdAf+rz/m2V8x7lc4KGmWg7ag DMlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-phdr :dkim-signature; bh=eFTXXk3T4XgQDmNF1yXHpOrZQWkja9D5zGYogAuEtx0=; b=inADc94XWFELoNzOZLdHqRKKNL2hPqUgKprsIT2Jq8Nwn6YxGkQ8rZ5sj1VVSDncRR b6D6JU11/HP9On1yjju7govvK0YalE0nBEntl6Vf77N0lhcaKgONcxK+2OacYfPloSYA YB/mc+GoOQ7FfrWDgUMQJOBYMiG71rnjQX1dp8z8oKZlG2wU7fW9uRJJsAXLcJtvh5BW TpAdf6KR3JSS97Z5kzhxrE9NTJx+917cUk/8z6eJtDhpDM7bpAe6Zgt6oGkTGcqJJTUD pE60fp3i632LX1yzZLNCPdMMWsR8V6V1Ry9HfzJ8GwaOtO5mBFcvCMJL3kikUxCHuOlX QG5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tycho.nsa.gov header.s=tycho.nsa.gov header.b=Oi6ccJo9; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tycho.nsa.gov Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g90si12849323plb.282.2019.06.11.07.32.57; Tue, 11 Jun 2019 07:33:12 -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=@tycho.nsa.gov header.s=tycho.nsa.gov header.b=Oi6ccJo9; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tycho.nsa.gov Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403762AbfFKOcq (ORCPT + 99 others); Tue, 11 Jun 2019 10:32:46 -0400 Received: from upbd19pa09.eemsg.mail.mil ([214.24.27.84]:55673 "EHLO UPBD19PA09.eemsg.mail.mil" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387551AbfFKOcp (ORCPT ); Tue, 11 Jun 2019 10:32:45 -0400 X-EEMSG-check-017: 202016600|UPBD19PA09_EEMSG_MP9.csd.disa.mil Received: from emsm-gh1-uea11.ncsc.mil ([214.29.60.3]) by UPBD19PA09.eemsg.mail.mil with ESMTP/TLS/DHE-RSA-AES256-SHA256; 11 Jun 2019 14:32:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho.nsa.gov; i=@tycho.nsa.gov; q=dns/txt; s=tycho.nsa.gov; t=1560263555; x=1591799555; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=eFTXXk3T4XgQDmNF1yXHpOrZQWkja9D5zGYogAuEtx0=; b=Oi6ccJo9Rkd2wqPHbWC2qBQCbbtC2ot//QXTAZXb1bPpBRwWN11ZMlru Q7Cq5hNn7ie9IAukGDMoyNYhB9O5i434CMicqBoZfmzzaOXilguPORtsY jC04qafCTnkvXgmjS/AXrmCZ2swugNINESYy7jrbXCEloZXIQN3sVRf1E MzZ5u5tlfuhrtoaqxUhJdy0B5TtcEy2g3d1C8mNj4FENsEMEwoQ1qhF7/ jET+2DJghFXv8vE6rSIariFVSwhQQrfnm2W6admaFIayX3Ofwoi2JDrYz uRIB21Lth7yHxOWFp9pyOXsG2ouOu8OyGd2lJlrscgkX1DfWikPVuWKe5 g==; X-IronPort-AV: E=Sophos;i="5.63,579,1557187200"; d="scan'208";a="28815970" IronPort-PHdr: =?us-ascii?q?9a23=3AMV5BwhMuYaH4IEzx4jMl6mtUPXoX/o7sNwtQ0K?= =?us-ascii?q?IMzox0K/v4r8bcNUDSrc9gkEXOFd2Cra4d0qyP7v2rBD1IyK3CmUhKSIZLWR?= =?us-ascii?q?4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBx?= =?us-ascii?q?rwKxd+KPjrFY7OlcS30P2594HObwlSizexfK5+IA+roQjRtsQajotvJ6IswR?= =?us-ascii?q?bVv3VEfPhby3l1LlyJhRb84cmw/J9n8ytOvv8q6tBNX6bncakmVLJUFDspPX?= =?us-ascii?q?w7683trhnDUBCA5mAAXWUMkxpHGBbK4RfnVZrsqCT6t+592C6HPc3qSL0/RD?= =?us-ascii?q?qv47t3RBLulSwKLCAy/n3JhcNsjaJbuBOhqAJ5w47Ie4GeKf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P9yu/dWTjZfMrPqyWH6mVp1WImHXytapsieqrUl3HRq6nuqomd?= =?us-ascii?q?yvRQwnzSjT3txjXizQrQr1Zs/t2rjsdapMd1JlFRfH4MpzB496n5F40JoZwn?= =?us-ascii?q?ULro6e/XMan2P+K5BQ0OT1a39bFhARxNuA2xTowE1uKDqywov9UniMip96a8?= =?us-ascii?q?KSfnId2iV76dtDTqiT8uoXzmNOvlOkoFeJMrBGlTAHxK5rsSVLjg=3D=3D?= X-IPAS-Result: =?us-ascii?q?A2CmAwB0uv9c/wHyM5BmHAEBAQQBAQcEAQGBZYFiBSqBO?= =?us-ascii?q?wEyKIQVknNMAQEBAQEBBoEQJYlRjySBZwkBAQEBAQEBAQE0AQIBAYRAAoJ+I?= =?us-ascii?q?zgTAQMBAQEEAQEBAQMBAWwogjopAYJnAQIDIw8BBT8CEAsOCgICJgICVwYBD?= =?us-ascii?q?AYCAQGCUww/gXcUqQqBMYVHgy2BRoEMKItdF3iBB4E4DIIqBy4+hAiDRoJYB?= =?us-ascii?q?I15mk1qCYISghuRJAYbgiWCH4RehAeGAoN1jRaYTCGBWCsIAhgIIQ+DJ5BuI?= =?us-ascii?q?wMwgQYBAY8IAQE?= Received: from tarius.tycho.ncsc.mil ([144.51.242.1]) by emsm-gh1-uea11.NCSC.MIL with ESMTP; 11 Jun 2019 14:32:32 +0000 Received: from moss-pluto.infosec.tycho.ncsc.mil (moss-pluto [192.168.25.131]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id x5BEWUaX007043; Tue, 11 Jun 2019 10:32:30 -0400 Subject: Re: [RFC][PATCH 00/13] Mount, FS, Block and Keyrings notifications [ver #4] To: Andy Lutomirski , Casey Schaufler Cc: Andy Lutomirski , 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 References: <155991702981.15579.6007568669839441045.stgit@warthog.procyon.org.uk> <0cf7a49d-85f6-fba9-62ec-a378e0b76adf@schaufler-ca.com> <4b7d02b2-2434-8a7c-66cc-7dbebc37efbc@schaufler-ca.com> <25d88489-9850-f092-205e-0a4fc292f41b@schaufler-ca.com> <97BA9EB5-4E62-4E3A-BD97-CEC34F16FCFF@amacapital.net> From: Stephen Smalley Message-ID: Date: Tue, 11 Jun 2019 10:32:30 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <97BA9EB5-4E62-4E3A-BD97-CEC34F16FCFF@amacapital.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/10/19 8:13 PM, Andy Lutomirski wrote: > > >> On Jun 10, 2019, at 2:25 PM, Casey Schaufler wrote: >> >>> On 6/10/2019 12:53 PM, Andy Lutomirski wrote: >>> On Mon, Jun 10, 2019 at 12:34 PM Casey Schaufler wrote: >>>>>>> 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. >>> This argument is pointless. >>> >>> Please humor me and just give me an example. If you think you have >>> already done so, feel free to repeat yourself. If you have no >>> example, then please just say so. >> >> To repeat the /dev/null example: >> >> Process A and process B both open /dev/null. >> A and B can write and read to their hearts content >> to/from /dev/null without ever once communicating. >> The mutual accessibility of /dev/null in no way implies that >> A and B can communicate. If A can set a watch on /dev/null, >> and B triggers an event, there still has to be an access >> check on the delivery of the event because delivering an event >> to A is not an action on /dev/null, but on A. >> > > At discussed, this is an irrelevant straw man. This patch series does not produce events when this happens. I’m looking for a relevant example, please. >> >> >>> An unprivileged >>> user can create a new userns and a new mount ns, but then they're >>> modifying a whole different mount tree. >> >> Within those namespaces you can still have multiple users, >> constrained be system access control policy. > > And the one doing the mounting will be constrained by MAC and DAC policy, as always. The namespace creator is, from the perspective of those processes, admin. > >> >>> >>>>>>> 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’m 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? >>> It makes sense. As I see it, the way that a sensible policy should do >>> this is by making sure that there are no sockets, pipes, etc that >>> Process A can write and that Process B can read. >> >> You can't explain UDP controls without doing the access check >> on packet delivery. The sendmsg() succeeds when the packet leaves >> the sender. There doesn't even have to be a socket bound to the >> port. The only opportunity you have for control is on packet >> delivery, which is the only point at which you can have the >> information required. > > Huh? You sendmsg() from an address to an address. My point is that, for most purposes, that’s all the information that’s needed. > >> >>> If you really want to prevent a malicious process with TopSecret data >>> from sending it to a different process, then you can't use Linux on >>> x86 or ARM. Maybe that will be fixed some day, but you're going to >>> need to use an extremely tight sandbox to make this work. >> >> I won't be commenting on that. > > Then why is preventing this is an absolute requirement? It’s unattainable. > >> >>> >>>>>>> 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? >>>> >>> POSIX signal restrictions aren't there to prevent two processes from >>> communicating. They're there to prevent the sender from manipulating >>> or crashing the receiver without appropriate privilege. >> >> POSIX signal restrictions have a long history. In the P10031e/2c >> debates both communication and manipulation where seriously >> considered. I would say both are true. >> >>>>> 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 == active entity >>>> Object == passive entity >>>> >>>> Triggering an event is, like calling kill(), an action! >>>> >>> And here is where I disagree with your interpretation. Triggering an >>> event is a side effect of writing to the file. There are *two* >>> security relevant actions, not one, and they are: >>> >>> First, the write: >>> >>> Subject == the writer >>> Action == write >>> Object == the file >>> >>> Then the event, which could be modeled in a couple of ways: >>> >>> Subject == the file >> >> Files are not subjects. They are passive entities. >> >>> Action == notify >>> Object == the recipient > > Great. Then use the variant below. > >>> >>> or >>> >>> Subject == the recipient >>> Action == watch >>> Object == the file >>> >>> By conflating these two actions into one, you've made the modeling >>> very hard, and you start running into all these nasty questions like >>> "who actually closed this open file" >> >> No, I've made the code more difficult. >> You can not call >> the file a subject. That is just wrong. It's not a valid >> model. > > You’ve ignored the “Action == watch” variant. Do you care to comment? While I agree with this model in general, I will note two caveats when trying to apply this to watches/notifications: 1) The object on which the notification was triggered and the object on which the watch was placed are not necessarily the same and access to one might not imply access to the other, 2) If notifications can be triggered by read-like operations (as in fanotify, for example), then a "read" can be turned into a "write" flow through a notification. Whether or not these caveats are applicable to the notifications in this series I am not clear.