From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, T_DKIMWL_WL_HIGH,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7A3FC28CC5 for ; Wed, 5 Jun 2019 19:28:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 951C6206C3 for ; Wed, 5 Jun 2019 19:28:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559762927; bh=da4vdqyz2Yme7cA4V1MHlD7iuvel2OX6wiT4hesZ8Gs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=OvC1Ilyih9ik30ON8T2EtTuE1Tuxf6BMJNtSU2X7t8s4GiIkk4x37cnk5jInoLeeV aAltN7FmgLeRjsOmPrs5IVvvDx8IOU3Q1XeoIfdP5ejWqURKoOAWaYsot9cEcU6Ak3 EbIhcKbr381uOS5ggL56smz3hlwZgVUmPfbk9y4M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726682AbfFET2r (ORCPT ); Wed, 5 Jun 2019 15:28:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:38852 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726280AbfFET2q (ORCPT ); Wed, 5 Jun 2019 15:28:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9CF99206BB; Wed, 5 Jun 2019 19:28:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559762925; bh=da4vdqyz2Yme7cA4V1MHlD7iuvel2OX6wiT4hesZ8Gs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BnCNWFWZc6WFQpPgq8oWAUJhMFZQWWwmZwy5J37GOO0asHCDGGNyy2OZaScErfCAd +Kpnw5dKlic3ZZPGfuxQ6El1DlNkO5k3ONonLuBknkpHtA+P3W4J7CYNSqJB2Gch3z DBBQPGMWJnTImFLSHJRIibNQIF4Q9Wobgc/MPfow= Date: Wed, 5 Jun 2019 21:28:42 +0200 From: Greg KH To: Stephen Smalley Cc: Andy Lutomirski , Casey Schaufler , Andy Lutomirski , David Howells , Al Viro , raven@themaw.net, Linux FS Devel , Linux API , linux-block@vger.kernel.org, keyrings@vger.kernel.org, LSM List , LKML Subject: Re: [RFC][PATCH 0/8] Mount, FS, Block and Keyrings notifications [ver #2] Message-ID: <20190605192842.GA9590@kroah.com> References: <50c2ea19-6ae8-1f42-97ef-ba5c95e40475@schaufler-ca.com> <155966609977.17449.5624614375035334363.stgit@warthog.procyon.org.uk> <20192.1559724094@warthog.procyon.org.uk> <9a9406ba-eda4-e3ec-2100-9f7cf1d5c130@schaufler-ca.com> <15CBE0B8-2797-433B-B9D7-B059FD1B9266@amacapital.net> <5dae2a59-1b91-7b35-7578-481d03c677bc@tycho.nsa.gov> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5dae2a59-1b91-7b35-7578-481d03c677bc@tycho.nsa.gov> User-Agent: Mutt/1.12.0 (2019-05-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 05, 2019 at 02:25:33PM -0400, Stephen Smalley wrote: > On 6/5/19 1:47 PM, Andy Lutomirski wrote: > > > > > On Jun 5, 2019, at 10:01 AM, Casey Schaufler wrote: > > > > > > > On 6/5/2019 9:04 AM, Andy Lutomirski wrote: > > > > > On Wed, Jun 5, 2019 at 7:51 AM Casey Schaufler wrote: > > > > > > On 6/5/2019 1:41 AM, David Howells wrote: > > > > > > Casey Schaufler wrote: > > > > > > > > > > > > > I will try to explain the problem once again. If process A > > > > > > > sends a signal (writes information) to process B the kernel > > > > > > > checks that either process A has the same UID as process B > > > > > > > or that process A has privilege to override that policy. > > > > > > > Process B is passive in this access control decision, while > > > > > > > process A is active. In the event delivery case, process A > > > > > > > does something (e.g. modifies a keyring) that generates an > > > > > > > event, which is then sent to process B's event buffer. > > > > > > I think this might be the core sticking point here. It looks like two > > > > > > different situations: > > > > > > > > > > > > (1) A explicitly sends event to B (eg. signalling, sendmsg, etc.) > > > > > > > > > > > > (2) A implicitly and unknowingly sends event to B as a side effect of some > > > > > > other action (eg. B has a watch for the event A did). > > > > > > > > > > > > The LSM treats them as the same: that is B must have MAC authorisation to send > > > > > > a message to A. > > > > > YES! > > > > > > > > > > Threat is about what you can do, not what you intend to do. > > > > > > > > > > And it would be really great if you put some thought into what > > > > > a rational model would be for UID based controls, too. > > > > > > > > > > > But there are problems with not sending the event: > > > > > > > > > > > > (1) B's internal state is then corrupt (or, at least, unknowingly invalid). > > > > > Then B is a badly written program. > > > > Either I'm misunderstanding you or I strongly disagree. > > > > > > A program needs to be aware of the conditions under > > > which it gets event, *including the possibility that > > > it may not get an event that it's not allowed*. Do you > > > regularly write programs that go into corrupt states > > > if an open() fails? Or where read() returns less than > > > the amount of data you ask for? > > > > I do not regularly write programs that handle read() omitting data in the middle of a TCP stream. I also don’t write programs that wait for processes to die and need to handle the case where a child is dead, waitid() can see it, but SIGCHLD wasn’t sent because “security”. > > > > > > > > > If B has > > > > authority to detect a certain action, and A has authority to perform > > > > that action, then refusing to notify B because B is somehow missing > > > > some special authorization to be notified by A is nuts. > > > > > > You are hand-waving the notion of authority. You are assuming > > > that if A can read X and B can read X that A can write B. > > > > No, read it again please. I’m assuming that if A can *write* X and B can read X then A can send information to B. > > I guess the questions here are: > > 1) How do we handle recursive notification support, since we can't check > that B can read everything below a given directory easily? Perhaps we can > argue that if I have watch permission to / then that implies visibility to > everything below it but that is rather broad. How do you handle fanotify today which I think can do this? thanks, greg k-h