Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6671376ybi; Wed, 29 May 2019 11:13:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxPZY9oIWXOETh/g229HuBGiHVNvjVFqNreLGkorzHToDcll6oEilZnxuLfuV/kM6bZX2Dz X-Received: by 2002:a65:56c5:: with SMTP id w5mr139681148pgs.434.1559153604358; Wed, 29 May 2019 11:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559153604; cv=none; d=google.com; s=arc-20160816; b=PoCFJD/3c4CK1ANXEUNxC4eECK1vejC4pfx8dWPbHqx+6BRM+GvpsO93v2mnUFB41+ Gf2HajfBNNBQoLT0P9lazPqw99bRtcQ262BPrWmHhUfDtLUNPWmXll7/ad3OMExAXMy6 k38zOT72suBQCNvKeyTOzh9qhfAuZeIeN8Sg9DY613510jzw4vDs/RiSK+KZntHGnFQp c02IzGF89zjzY7oImE5Nm2+DhfZ0T3Kk+un9yPDusHCIYOKwZ8jZCfvsoDmB6/cCD6OP gvZDgHSuzQX48e8rsHlWvSCBFM5piBZDST9rG4b9nk4jvhsDgeUDmJVR5ZKbE2gthIXF EMuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=G+LiWYxMhAJfHLsG+v7LjjWofEdKFy9soNO63HkV+20=; b=d8f8cAn9xGy8UoQ+t7CUtfjDuPo4iYK3Wm40nouQOkXsDGMngR2iQKfKOPiHmrItBL TMh2c3S1oJY3eQwhj7FEYGfm1oY74+gV+o65TEyJiMTaA9sRMh0tKXmm6JbRlcfZEWoj diPUnkNmDulEIAUJVuihv/3SYJPAfzSm2OVmW0sMPzEHKYSrwhDz+2cWoVb2tkCrfaWd zuUmrfhnK3sAvNmzb8D+M7t9Kb/BiPXQkzmk/bzvFD3+muUtdMP5ap0OpE6RpS7zxzEY kGCa4kSxHoQf9L3RAcvNmUq3qEB/Z+YnrwjS6TrXb27MH2Q01OKR8OVy2EAGP8oIz0Jx 029A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=rm6Op6Is; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gn19si369058plb.67.2019.05.29.11.13.08; Wed, 29 May 2019 11:13:24 -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=@google.com header.s=20161025 header.b=rm6Op6Is; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727400AbfE2SMI (ORCPT + 99 others); Wed, 29 May 2019 14:12:08 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:35532 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727195AbfE2SMI (ORCPT ); Wed, 29 May 2019 14:12:08 -0400 Received: by mail-ot1-f65.google.com with SMTP id n14so3008870otk.2 for ; Wed, 29 May 2019 11:12:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=G+LiWYxMhAJfHLsG+v7LjjWofEdKFy9soNO63HkV+20=; b=rm6Op6Is2WyS28sYE2LrvmC6hYEVlBfSDkJUVaKtEPXkpkcEEgwFZx9EaFMzxA7QHN jGLyhbIH7d3TLdKtfCeO8OKvbDMjlklbUFMA1y1Fzv7/GietI7aZdu2oEsVBu6nVgRND D8Pg4xBc/mwxRuJEOgG/C4KpUU6MF5i1lnkZLF+zkyEz7Jx20Jz5VQFv40woP8Itc/Vb j9auqkQ5XEeP8zQAuW8EihZdk+7rwfnJdOzqFkabhy2air3lPgExNOXh8nOIvkDc2p7e nwmhXppgGZ1QaQxGpM3UFjxRCl6MxPJt9OTN+C6ag2JF4pxEOtDBt//jHJ1wROrhskj/ /LIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=G+LiWYxMhAJfHLsG+v7LjjWofEdKFy9soNO63HkV+20=; b=ThMUWlfwDlp+DVToSc0sYw/eCZFeC4NCVEhJYna/gP0MO2u1aayBIXrvnfiOqDknRm uTjMveaClPwU+2rQahHSomgvRrVEfEstjORUVXjQf3s/i9nEKugyCdEtrpT7l2KvLb9J bjH3A8hfphorzMvJM/5wUk8rP65IaDNpM1gEi24puFokqPEjet4Qv45iohoXBhCwsbf1 E2F6PG8FUkX0LozzsXumZPG1N/x3oTbpTj/G/OFar5CQxXm8OyLwqgZtqD0jf5Pq+Qa3 Hnjj5UhUfVytVR60w8UsqFZ6YVTFdSHI9VdMOmHbKn8GoHM/HgCm3MHEGozlner9veR8 6dzQ== X-Gm-Message-State: APjAAAUd557AgCNRYxK6CKD5BSZPCNCsFCFUeZxLluSjDHC6Y5z2MdU8 MJMpGTDUFxIsWrRzaKxlL8aSi+5WcagDUTLWe+SzZw== X-Received: by 2002:a9d:148:: with SMTP id 66mr30932226otu.32.1559153527342; Wed, 29 May 2019 11:12:07 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <058f227c-71ab-a6f4-00bf-b8782b3b2956@schaufler-ca.com> From: Jann Horn Date: Wed, 29 May 2019 20:11:40 +0200 Message-ID: Subject: Re: [PATCH 3/7] vfs: Add a mount-notification facility To: Casey Schaufler Cc: Andy Lutomirski , David Howells , Al Viro , raven@themaw.net, linux-fsdevel , Linux API , linux-block@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module , kernel list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 29, 2019 at 7:46 PM 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 = 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 gets > >>>> dropped? > >>> IIRC, that's what Casey argued is the right thing to do from a security 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 *receiver* 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. In other words, a classic covert channel. You can't really prevent two cooperating processes from communicating through a covert channel on a modern computer. You can transmit information through the scheduler, through hyperthread resource sharing, through CPU data caches, through disk contention, through page cache state, through RAM contention, and probably dozens of other ways that I can't think of right now. There have been plenty of papers that demonstrated things like an SSH connection between two virtual machines without network access running on the same physical host (), communication between a VM and a browser running on the host system, and so on.