Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8414099ybi; Thu, 6 Jun 2019 11:55:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdplz/LVV9zlrzCkwGF0QM9p6JvnGCI+MIqJuaAIvgUSnCe0xdFqDNMCKlHu4p6Ht05Mjx X-Received: by 2002:a17:90a:af8a:: with SMTP id w10mr1346447pjq.132.1559847353388; Thu, 06 Jun 2019 11:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559847353; cv=none; d=google.com; s=arc-20160816; b=JsloURZGAolm43jT9LD9SvpeLpw42j0G1+w66ZJZKxvCC7c5SYxaNATZxhj98yLZeI 1qna7M7iwQozKKUsiV7gRhQO/CVl0GJ90Gu2qjeOfSflpDLSpWLmzr+ly7CoaJaggZwy sy5+hiUVC1/Kh3mqWs/PoqBF4m6mRpL36tsmZWyI2bglemOCg5wp9pwDYA61CJB0YzGn VLv1CIEwQv25TT8UfAHcZh41rMO7/U022ISC/YeJpk7k3pbkkm1ktcIsspcATnPoucYQ h1knKWhw8oY0EEay0ww8g7rEfhYMb9SD4/5okGzHtrGBycojH2gA/ZSlOy4hW+eL2wwJ /X+A== 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=k0wQBj04nHhLiiBvdEH8li9eiVKRcrBRPuzzhHXNU+M=; b=X/OMcbj/45aQtzXwWdwo+W9f9VuqYZz6omL3K1juRez1iKNBxOoRzRem9aNySTN/T8 uNaRMpNXO4qeyJCy0mx6JoOt0zD6RzgwuVrafq03yhqeplDCGLFZDK1xStPvNTJqUXNY bvGb/m5EI53Sdagpt5I1/K9WfKyC4rS2L7wfZ5KfAswhpnTgV9iVKrQ1zavZrem7We5O dmqqK1I5BZ1XoAdr/hHqui0Jo/dzhnHXI1uJAArt/De6rGqE/FHmq5JUfiCg2f0LK1hz vwV1ydh6XX/AkczBREh6i0xS3s7AYLtB/wwo8PmB5YRHiVYYn1cyds43kN8yLxCGX6lu zKKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ttqi5RnB; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l21si2594463pgb.409.2019.06.06.11.55.37; Thu, 06 Jun 2019 11:55:53 -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=@kernel.org header.s=default header.b=Ttqi5RnB; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730068AbfFFRSa (ORCPT + 99 others); Thu, 6 Jun 2019 13:18:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:51000 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730057AbfFFRS3 (ORCPT ); Thu, 6 Jun 2019 13:18:29 -0400 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A769C208E3 for ; Thu, 6 Jun 2019 17:18:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559841508; bh=xfZRqQoeex0rjsT5lia2MuMyCOHqkbEMbiBprno0lnU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Ttqi5RnBFnZ0CDlhhPjELblqvIx3Okp+N6+Ng2TOAKWVM7xvf7KU4+wxogP4eZ5SF LBtR5MEQe59HXUip5bZ/XyyoMvV8z/EDII14Gan+gDkQYiK4dvT0v1PAb4E9MaHaqS QJgBn/pRoUnH52BqjMBg6qThPcpvfUqAkGEwj0HU= Received: by mail-wr1-f48.google.com with SMTP id b17so2157063wrq.11 for ; Thu, 06 Jun 2019 10:18:28 -0700 (PDT) X-Gm-Message-State: APjAAAUShLXoME2f0PN69cyqswM5toXrWN3NPeRricBLfm128tiM9ssJ bn2WlT+tTAWKZMoDiOT3nz1htpt/iI4AQHUWYHvqlQ== X-Received: by 2002:a5d:4d06:: with SMTP id z6mr3348178wrt.343.1559841507169; Thu, 06 Jun 2019 10:18:27 -0700 (PDT) MIME-Version: 1.0 References: <155981411940.17513.7137844619951358374.stgit@warthog.procyon.org.uk> <155981413016.17513.10540579988392555403.stgit@warthog.procyon.org.uk> <176F8189-3BE9-4B8C-A4D5-8915436338FB@amacapital.net> <11031.1559833574@warthog.procyon.org.uk> In-Reply-To: <11031.1559833574@warthog.procyon.org.uk> From: Andy Lutomirski Date: Thu, 6 Jun 2019 10:18:16 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 01/10] security: Override creds in __fput() with last fputter's creds [ver #3] To: David Howells Cc: Al Viro , Casey Schaufler , raven@themaw.net, Linux FS Devel , Linux API , linux-block@vger.kernel.org, keyrings@vger.kernel.org, LSM List , LKML , Jann Horn 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 Thu, Jun 6, 2019 at 8:06 AM David Howells wrote: > > Andy Lutomirski wrote: > > > > So that the LSM can see the credentials of the last process to do an fput() > > > on a file object when the file object is being dismantled, do the following > > > steps: > > > > > > > I still maintain that this is a giant design error. > > Yes, I know. This was primarily a post so that Greg could play with the USB > notifications stuff I added. The LSM support isn't resolved and is unchanged. > > > Can someone at least come up with a single valid use case that isn't > > entirely full of bugs? > > "Entirely full of bugs"? I can say "hey, I have this policy that the person who triggered an event needs such-and-such permission, otherwise the event gets suppressed". But this isn't a full use case, and it's buggy. It's not a full use case because I haven't specified what my actual goal is and why this particular policy achieves my goals. And it's entirely full of bugs because, as this patch so nicely illustrates, it's not well defined who triggered the event. For example, if I exec a setuid process, who triggers the close? What if I send the fd to systemd over a socket and immediately close my copy before systemd gets (and ignores) the message? Or if I send it to Wayland, or to any other process? A file is closed when everyone is done with it. Trying to figure out who the last intentional user of the file was seems little better than random guessing. Defining a security policy based on it seems like a poor idea. > > How would you propose I deal with Casey's requirement? I'm getting the > feeling you're going to nak it if I try to fulfil that and he's going to nak > it if I don't. > Casey, I think you need to state your requirement in a way that's well defined, and I think you need to make a compelling case that your requirement is indeed worth dictating the design of parts of the kernel outside LSM.