Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5886394iog; Thu, 23 Jun 2022 07:16:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1unIeoen94M9ocNaBasN7FwZn7a+J1x/+zOJW8pUycVte4KzznnxQU5EeFuGFZkI2EiqsDU X-Received: by 2002:a17:906:c7c1:b0:711:d2e9:99d0 with SMTP id dc1-20020a170906c7c100b00711d2e999d0mr8414729ejb.639.1655993817107; Thu, 23 Jun 2022 07:16:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655993817; cv=none; d=google.com; s=arc-20160816; b=XKlOSAT2rwX7AEuPkSVZG3QP14mj/nlTDj2uxnPojE4Q+p0nclNQZ1fnc2wIOLHCFt 8mMI7/nbpXV881zR1BhNG1pRR8UeWtNl8PMDX1KHkx/5ID6nhctZnCQLetAFSvztg6GC ys99bWP7Vzf2rEJHo6iaV6cbxzBmYJGh1+ggztmVsNXdq5iNfS2cPiNOezdCoAb6a5fL wKUXcIZF5S3811hGw0l9//wttLzvHgxhyw+M4u+FIrAR/jEsQi9FRtL4Gh+m1Eu3eU8x bw9HtTs/tyq8gRZzfsyxYIBxEHXsxM6vJd7v/eMee4loDMZB628J0sTRJsVYUSmTD1yK Uuww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature:dkim-signature; bh=7ihpOqqmzBmbjLevqW3iWBgK9wWWlreJI6e5f13kHzA=; b=vBR8B1I72IMxCZijTFY6d/ePEORD9wmVnV9mSOqfIBFjAqRDq4Eu0gOEoE4VJq6cW6 hRlzfiFqrUVfeVrVZs1Vj5VdJDzQI6u3hsqAjlOX6udjHbX90yZj2lr9gav1cfQ9cC42 CkTayvaF9lz+dvyreD8XNuQdidA3arHk6tMddoeW709iuaVIILKP+Evn9s6DJ5dmt7Mz KqJkKzJyoZefKS2BAD2XlzHPeIUeeARcupNxmzPtyNGK5rftPPQsEJsGH4lZz/e+Au5Q 0unKBbFAmX8drBta4dV4E6pK8gWfcvnYNi4oMjXH6oZar7V/551CZ02jGbTvHmVpTXOB xJ1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hansenpartnership.com header.s=20151216 header.b=jQZxMm2q; dkim=pass header.i=@hansenpartnership.com header.s=20151216 header.b=eBrnwNmo; 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=hansenpartnership.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a17-20020a056402169100b0043580d730easi5958372edv.431.2022.06.23.07.16.31; Thu, 23 Jun 2022 07:16:57 -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=@hansenpartnership.com header.s=20151216 header.b=jQZxMm2q; dkim=pass header.i=@hansenpartnership.com header.s=20151216 header.b=eBrnwNmo; 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=hansenpartnership.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231612AbiFWNXf (ORCPT + 99 others); Thu, 23 Jun 2022 09:23:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231907AbiFWNXc (ORCPT ); Thu, 23 Jun 2022 09:23:32 -0400 Received: from bedivere.hansenpartnership.com (bedivere.hansenpartnership.com [96.44.175.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA18C12AC3 for ; Thu, 23 Jun 2022 06:23:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hansenpartnership.com; s=20151216; t=1655990602; bh=2+RnhRSYBf9t0pLNaFxZTzdzl+ka8qJGuDaaIJ0J+SE=; h=Message-ID:Subject:From:To:Date:In-Reply-To:References:From; b=jQZxMm2qirAr+munyYWPBowvfq9hHN90Qjs6CLjfowE3BiVJ37/R2Y0y+OoSYHzov 2ODPECkLsMZa5jHp4mf5/RN+kal13JqodQkywQs78EY54f1wTMg44+63Yjp8wsGgs7 /Et2tUa+r685pKlwTloW2yk1NNkDyjconWxyZO/c= Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id 02B821281161; Thu, 23 Jun 2022 09:23:22 -0400 (EDT) Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9zhIpAMrBkCT; Thu, 23 Jun 2022 09:23:21 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hansenpartnership.com; s=20151216; t=1655990601; bh=2+RnhRSYBf9t0pLNaFxZTzdzl+ka8qJGuDaaIJ0J+SE=; h=Message-ID:Subject:From:To:Date:In-Reply-To:References:From; b=eBrnwNmoTPKz2acfj3bSSE37qXRZymR6d57PTcwrdbVLvtNEzgwvb/jnjwQM3LZxK DABRjQo8IG8dpHo8+xRe79xEm+ChL5obtdmWZsLK8l3DoFbw5T0QrjGxcarv7kfRHq k+DN7QN6QiXBzDt0DlqdF03HzXqaw670zyu8Vl9A= Received: from [IPv6:2601:5c4:4300:c551:a71:90ff:fec2:f05b] (unknown [IPv6:2601:5c4:4300:c551:a71:90ff:fec2:f05b]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id A62431280DD8; Thu, 23 Jun 2022 09:23:20 -0400 (EDT) Message-ID: <41ca51e8db9907d9060cc38adb59a66dcae4c59b.camel@HansenPartnership.com> Subject: Re: [RFC PATCH v2 2/3] fs: define a firmware security filesystem named fwsecurityfs From: James Bottomley To: Greg Kroah-Hartman , Nayna Jain Cc: 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 Date: Thu, 23 Jun 2022 09:23:19 -0400 In-Reply-To: References: <20220622215648.96723-1-nayna@linux.ibm.com> <20220622215648.96723-3-nayna@linux.ibm.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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 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. James