Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2717659iog; Mon, 27 Jun 2022 01:04:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uTRGGzPjWlzDeH/VzemgVSx/VxjmDwWkSw7oMe+j8MBttgDlYaiJ9w3REGUgKRRR5DpHMu X-Received: by 2002:a05:6402:43cd:b0:435:d76d:f9a7 with SMTP id p13-20020a05640243cd00b00435d76df9a7mr14925929edc.119.1656317093675; Mon, 27 Jun 2022 01:04:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656317093; cv=none; d=google.com; s=arc-20160816; b=F6MFdyNXbPY8PilB3T4MjvKYn2pmz7IVffEZeUIb4u5/CHs0v1wZMoR0XOw/+XcUhP Z3bQiTkCVD8jRdp3oaAGFvI4oqEi7x8geeVnNnvkef8eai4hqMfI4hZ1kxJxEZ4gry2t Nc/pG3ApdxqhvbOc0xn6xKgsnTzTBTsdnwnAGuJO990cnPF1GT1AquKNj+BZHxcE4HXQ SPHRbNQNZUI3f8OT5xDpJ8TKVeY8+VTDHkj2LmufuaBlf9aWxuqR6cIMW3cJe51Y6S47 LYdOQhEvKdPxjjPj0oZJlBEcH73wJwcAPUD2L1JN0jmOrnOQ5bAdcsBXLzepCs9MoIr6 V7uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0pcfGd1YJEYgHoY3jrka3KTvTY/ru4q5wFkJcCPGeNk=; b=Si1/4OGUaCD9XWLrmiOMnGbYhbta5wdPG6PI7GBe2nXDRd2+RmVsVX2RMIBHJEVxAd z9pFIccvimv9m0s/36aXmyhuL+Wsq7wJIci12TwuAmCmAhZK6/94IWLCMziyo2EBAAL8 WaU2i8vpK2GS/MzUOVT1XJ5YoN560+qlu2mI0AB373GynANehIof7zMprIb8QRDtzdzm wrnhVD1VmsA8JjP/XJR7T0rNzY0+LnjN6HRQJ1AYhodjTy6DZHoc+G9gj9ipb5w3EMoR z4Or5gQREv7aOIg26UgRf7l2NNHyUwsFZ+QG+2KYejNSp5hwTRROyNwvyYsPmLbxwhCS ZDRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i3ldFsiG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go6-20020a1709070d8600b00725be17a41bsi1237197ejc.740.2022.06.27.01.04.29; Mon, 27 Jun 2022 01:04:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i3ldFsiG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232416AbiF0Hhh (ORCPT + 99 others); Mon, 27 Jun 2022 03:37:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232965AbiF0Hhe (ORCPT ); Mon, 27 Jun 2022 03:37:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D5A760D5; Mon, 27 Jun 2022 00:37:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EA81561369; Mon, 27 Jun 2022 07:37:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A45D7C341C8; Mon, 27 Jun 2022 07:37:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656315451; bh=DsZDqRgytXwZKzppv5E+EkTb1K4NGGC2jAstmBQ31VE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=i3ldFsiGRWyUL2/7EHUzj3ADKKVrTcF+8yJXjybLKY3QJPs/zZsAplrMS1PPI5PYs 4Q5txUsaV5n7fPa9vtZErhohoGy5ahsFShlfNq5dXajY7pEAtLxWvu5a2waWGEX43C Whe69Fv6I/yDBYJrkHxRnOpS0OVtoN/TI1fMRHN0= Date: Mon, 27 Jun 2022 09:37:28 +0200 From: Greg Kroah-Hartman To: Mimi Zohar Cc: James Bottomley , Nayna Jain , linuxppc-dev@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-efi@vger.kernel.org, linux-security-module , linux-kernel@vger.kernel.org, Michael Ellerman , Dov Murik , George Wilson , gjoyce@ibm.com, Matthew Garrett , Dave Hansen , Benjamin Herrenschmidt , Paul Mackerras Subject: Re: [RFC PATCH v2 2/3] fs: define a firmware security filesystem named fwsecurityfs Message-ID: References: <20220622215648.96723-1-nayna@linux.ibm.com> <20220622215648.96723-3-nayna@linux.ibm.com> <41ca51e8db9907d9060cc38adb59a66dcae4c59b.camel@HansenPartnership.com> <54af4a92356090d88639531413ea8cb46837bd18.camel@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54af4a92356090d88639531413ea8cb46837bd18.camel@linux.ibm.com> X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 26, 2022 at 11:48:06AM -0400, Mimi Zohar wrote: > On Thu, 2022-06-23 at 09:23 -0400, James Bottomley wrote: > > On Thu, 2022-06-23 at 10:54 +0200, Greg Kroah-Hartman wrote: > > [...] > > > > diff --git a/fs/fwsecurityfs/inode.c b/fs/fwsecurityfs/inode.c > > > > new file mode 100644 > > > > index 000000000000..5d06dc0de059 > > > > --- /dev/null > > > > +++ b/fs/fwsecurityfs/inode.c > > > > @@ -0,0 +1,159 @@ > > > > +// SPDX-License-Identifier: GPL-2.0-only > > > > +/* > > > > + * Copyright (C) 2022 IBM Corporation > > > > + * Author: Nayna Jain > > > > + */ > > > > + > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > + > > > > +#include "internal.h" > > > > + > > > > +int fwsecurityfs_remove_file(struct dentry *dentry) > > > > +{ > > > > + drop_nlink(d_inode(dentry)); > > > > + dput(dentry); > > > > + return 0; > > > > +}; > > > > +EXPORT_SYMBOL_GPL(fwsecurityfs_remove_file); > > > > + > > > > +int fwsecurityfs_create_file(const char *name, umode_t mode, > > > > + u16 filesize, struct dentry > > > > *parent, > > > > + struct dentry *dentry, > > > > + const struct file_operations > > > > *fops) > > > > +{ > > > > + struct inode *inode; > > > > + int error; > > > > + struct inode *dir; > > > > + > > > > + if (!parent) > > > > + return -EINVAL; > > > > + > > > > + dir = d_inode(parent); > > > > + pr_debug("securityfs: creating file '%s'\n", name); > > > > > > Did you forget to call simple_pin_fs() here or anywhere else? > > > > > > And this can be just one function with the directory creation file, > > > just check the mode and you will be fine. Look at securityfs as an > > > example of how to make this simpler. > > > > Actually, before you go down this route can you consider the namespace > > ramifications. In fact we're just having to rework securityfs to pull > > out all the simple_pin_... calls because simple_pin_... is completely > > inimical to namespaces. > > > > The first thing to consider is if you simply use securityfs you'll > > inherit all the simple_pin_... removal work and be namespace ready. It > > could be that creating a new filesystem that can't be namespaced is the > > right thing to do here, but at least ask the question: would we ever > > want any of these files to be presented selectively inside containers? > > If the answer is "yes" then simple_pin_... is the wrong interface. > > Greg, the securityfs changes James is referring to are part of the IMA > namespacing patch set: > https://lore.kernel.org/linux-integrity/20220420140633.753772-1-stefanb@linux.ibm.com/ > > I'd really appreciate your reviewing the first two patches: > [PATCH v12 01/26] securityfs: rework dentry creation > [PATCH v12 02/26] securityfs: Extend securityfs with namespacing > support Looks like others have already reviewed them, they seem sane to me if they past testing. thanks, greg k-h