Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3195776rwb; Sun, 20 Nov 2022 09:02:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf7AGo/JVldwT62+IJUs8K/cA8HHu6PxABoQOG1ONgOnA08Hr+t6H5GMqv2/Efa1Elq+g5gv X-Received: by 2002:a63:2306:0:b0:46f:918e:7339 with SMTP id j6-20020a632306000000b0046f918e7339mr14201281pgj.429.1668963740733; Sun, 20 Nov 2022 09:02:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668963740; cv=none; d=google.com; s=arc-20160816; b=RZfHPIOhRw3X6HQ5WM5H5xAAax+6QM9vukbNnehtbiNdygVDQDIGkMAHScsjXmBgdt F1akpFnan/uy0oWfl2QAzjoEpqmhPdHRgVFqQX1oCLbqePbi6RV4vSE0Q3R1Ztj2ml/I vdBmsq+9ggk+GrUzGUkhXT4xwaWTef88Uu/RsBieVrmsZ2L80FFbaDDemEeDQTh/ukoU x6OwZ7XA+74CiE/Q7TaSfnrTLHnS6pp3n6LtlxUUOwocPYL82l+TdFNJ11bUUwmhWr2E J7H821Xr+pdMOfgZW0iqcVWII94HzxZR16xzQRCVRjoKSWpYIycxWLXSFpDE6ZB03QZ0 UJNQ== 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=PKvvk0V982NWvDz8z9z4RiAFqUbuqD9GZbFskqyJqbM=; b=HiO4A2KCPF11gZELYFJOSZCbI6g43PPPZmAqredY7s2bS8X1plBneaje2kdyi3W0jI eWoYYlnvp+5ahIXEciL0teveG6nxxMyliQkAFOmGFAdvF9AMbKiSC4r54jSNLqKptJ7f SHqoC1YjWbKw3Cph7cPLf9FWYZDwzhuu87St8WC+lPWvKMDxvUZ36qp4KmJ7VXk8JIHi u7a2ornOt4mMP9tWO/opauoURwaLqWLrbf014fZGEcMxxzZTqUkxBuEJbt/aAWlhtMxQ sB+2+AtedFpl58ztZsvKFmtWNKRd2NGKhj7WfTiJghpcmhO7BVmf190CZawJYgT8jUGO E0ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="aIVe/EjL"; 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 g184-20020a636bc1000000b0046af665ed92si9884115pgc.480.2022.11.20.09.01.49; Sun, 20 Nov 2022 09:02:20 -0800 (PST) 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="aIVe/EjL"; 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 S229673AbiKTQXv (ORCPT + 91 others); Sun, 20 Nov 2022 11:23:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbiKTQXu (ORCPT ); Sun, 20 Nov 2022 11:23:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEF752DDB; Sun, 20 Nov 2022 08:23:48 -0800 (PST) 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 73C9160C83; Sun, 20 Nov 2022 16:23:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90CF3C433D6; Sun, 20 Nov 2022 16:23:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1668961427; bh=VEJFrHA3qn6Rwg4Teu5pGnSV2TQDYMG+LACbP7i1H4U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aIVe/EjLxTjJRpEYUbRy4/jlY4n20uQ/Ks7yVzv7byfrCKj1SxALQR5AviL9TGWNM Qs7NhTH5XJ2DOcNN2yPVnkMXYA8Cem1IjKH1LO9B0FogH8mclb99sNBwl9YMjAiikX ZIjmCDCv4H78R91ZVIeWE4TauaBx9CA+FR0cv9jg= Date: Sun, 20 Nov 2022 17:13:11 +0100 From: Greg Kroah-Hartman To: Nayna Cc: 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 , npiggin@gmail.com, christophe.leroy@csgroup.eu, Dov Murik , George Wilson , Matthew Garrett , Dave Hansen , Benjamin Herrenschmidt , Paul Mackerras , Russell Currey , Andrew Donnellan , Stefan Berger Subject: Re: [PATCH 2/4] fs: define a firmware security filesystem named fwsecurityfs Message-ID: References: <20221106210744.603240-1-nayna@linux.ibm.com> <20221106210744.603240-3-nayna@linux.ibm.com> <8447a726-c45d-8ebb-2a74-a4d759631e64@linux.vnet.ibm.com> <44191f02-7360-bca3-be8f-7809c1562e68@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 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 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 Sat, Nov 19, 2022 at 01:20:09AM -0500, Nayna wrote: > > On 11/17/22 16:27, Greg Kroah-Hartman wrote: > > On Mon, Nov 14, 2022 at 06:03:43PM -0500, Nayna wrote: > > > On 11/10/22 04:58, Greg Kroah-Hartman wrote: > > > > On Wed, Nov 09, 2022 at 03:10:37PM -0500, Nayna wrote: > > > > > On 11/9/22 08:46, Greg Kroah-Hartman wrote: > > > > > > On Sun, Nov 06, 2022 at 04:07:42PM -0500, Nayna Jain wrote: > > > > > > > securityfs is meant for Linux security subsystems to expose policies/logs > > > > > > > or any other information. However, there are various firmware security > > > > > > > features which expose their variables for user management via the kernel. > > > > > > > There is currently no single place to expose these variables. Different > > > > > > > platforms use sysfs/platform specific filesystem(efivarfs)/securityfs > > > > > > > interface as they find it appropriate. Thus, there is a gap in kernel > > > > > > > interfaces to expose variables for security features. > > > > > > > > > > > > > > Define a firmware security filesystem (fwsecurityfs) to be used by > > > > > > > security features enabled by the firmware. These variables are platform > > > > > > > specific. This filesystem provides platforms a way to implement their > > > > > > > own underlying semantics by defining own inode and file operations. > > > > > > > > > > > > > > Similar to securityfs, the firmware security filesystem is recommended > > > > > > > to be exposed on a well known mount point /sys/firmware/security. > > > > > > > Platforms can define their own directory or file structure under this path. > > > > > > > > > > > > > > Example: > > > > > > > > > > > > > > # mount -t fwsecurityfs fwsecurityfs /sys/firmware/security > > > > > > Why not juset use securityfs in /sys/security/firmware/ instead? Then > > > > > > you don't have to create a new filesystem and convince userspace to > > > > > > mount it in a specific location? > > > > > From man 5 sysfs page: > > > > > > > > > > /sys/firmware: This subdirectory contains interfaces for viewing and > > > > > manipulating firmware-specific objects and attributes. > > > > > > > > > > /sys/kernel: This subdirectory contains various files and subdirectories > > > > > that provide information about the running kernel. > > > > > > > > > > The security variables which are being exposed via fwsecurityfs are managed > > > > > by firmware, stored in firmware managed space and also often consumed by > > > > > firmware for enabling various security features. > > > > Ok, then just use the normal sysfs interface for /sys/firmware, why do > > > > you need a whole new filesystem type? > > > > > > > > > From git commit b67dbf9d4c1987c370fd18fdc4cf9d8aaea604c2, the purpose of > > > > > securityfs(/sys/kernel/security) is to provide a common place for all kernel > > > > > LSMs. The idea of > > > > > fwsecurityfs(/sys/firmware/security) is to similarly provide a common place > > > > > for all firmware security objects. > > > > > > > > > > /sys/firmware already exists. The patch now defines a new /security > > > > > directory in it for firmware security features. Using /sys/kernel/security > > > > > would mean scattering firmware objects in multiple places and confusing the > > > > > purpose of /sys/kernel and /sys/firmware. > > > > sysfs is confusing already, no problem with making it more confusing :) > > > > > > > > Just document where you add things and all should be fine. > > > > > > > > > Even though fwsecurityfs code is based on securityfs, since the two > > > > > filesystems expose different types of objects and have different > > > > > requirements, there are distinctions: > > > > > > > > > > 1. fwsecurityfs lets users create files in userspace, securityfs only allows > > > > > kernel subsystems to create files. > > > > Wait, why would a user ever create a file in this filesystem? If you > > > > need that, why not use configfs? That's what that is for, right? > > > The purpose of fwsecurityfs is not to expose configuration items but rather > > > security objects used for firmware security features. I think these are more > > > comparable to EFI variables, which are exposed via an EFI-specific > > > filesystem, efivarfs, rather than configfs. > > > > > > > > 2. firmware and kernel objects may have different requirements. For example, > > > > > consideration of namespacing. As per my understanding, namespacing is > > > > > applied to kernel resources and not firmware resources. That's why it makes > > > > > sense to add support for namespacing in securityfs, but we concluded that > > > > > fwsecurityfs currently doesn't need it. Another but similar example of it > > > > > is: TPM space, which is exposed from hardware. For containers, the TPM would > > > > > be made as virtual/software TPM. Similarly for firmware space for > > > > > containers, it would have to be something virtualized/software version of > > > > > it. > > > > I do not understand, sorry. What does namespaces have to do with this? > > > > sysfs can already handle namespaces just fine, why not use that? > > > Firmware objects are not namespaced. I mentioned it here as an example of > > > the difference between firmware and kernel objects. It is also in response > > > to the feedback from James Bottomley in RFC v2 [https://lore.kernel.org/linuxppc-dev/41ca51e8db9907d9060cc38adb59a66dcae4c59b.camel@HansenPartnership.com/]. > > I do not understand, sorry. Do you want to use a namespace for these or > > not? The code does not seem to be using namespaces. You can use sysfs > > with, or without, a namespace so I don't understand the issue here. > > > > With your code, there is no namespace. > > You are correct. There's no namespace for these. So again, I do not understand. Do you want to use filesystem namespaces, or do you not? How again can you not use sysfs or securityfs due to namespaces? What is missing? confused, greg k-h