From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BB57C433FE for ; Mon, 21 Nov 2022 18:12:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230512AbiKUSMo (ORCPT ); Mon, 21 Nov 2022 13:12:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229864AbiKUSMn (ORCPT ); Mon, 21 Nov 2022 13:12:43 -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 9F8E9233B6; Mon, 21 Nov 2022 10:12:41 -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 3E4EE61374; Mon, 21 Nov 2022 18:12:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 092D4C433D7; Mon, 21 Nov 2022 18:12:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1669054360; bh=3hKMiUWSJlNUwha4kRCYF6DVvlsHYc9XldvHrQoGMS0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ev62ZYHqi31e22gyDngGK7EIfQceHN+E3DDkSWP1G3IXOBeCWfQmDmemGbtRgLukA PMGWLB5QgVoQQljqfoH29fsa4KLSPEWOOnpn5Aiaqd8e5vxAhXnoElRuLtbWLwGYMI TyhDZXlGf4swVfntlNQFIjIo5U9cdNUCbgZf9t6c= Date: Mon, 21 Nov 2022 19:12:36 +0100 From: Greg Kroah-Hartman To: James Bottomley Cc: Nayna , 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: <44191f02-7360-bca3-be8f-7809c1562e68@linux.vnet.ibm.com> <88111914afc6204b2a3fb82ded5d9bfb6420bca6.camel@HansenPartnership.com> <10c85b8f4779700b82596c4a968daead65a29801.camel@HansenPartnership.com> <94fe007e8eab8bc7ae3f56b88ad94646b4673657.camel@HansenPartnership.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <94fe007e8eab8bc7ae3f56b88ad94646b4673657.camel@HansenPartnership.com> Precedence: bulk List-ID: On Mon, Nov 21, 2022 at 12:33:55PM -0500, James Bottomley wrote: > On Mon, 2022-11-21 at 16:05 +0100, Greg Kroah-Hartman wrote: > > On Mon, Nov 21, 2022 at 09:03:18AM -0500, James Bottomley wrote: > > > On Mon, 2022-11-21 at 12:05 +0100, Greg Kroah-Hartman wrote: > > > > On Sun, Nov 20, 2022 at 10:14:26PM -0500, James Bottomley wrote: > [...] > > > > > I already explained in the email that sysfs contains APIs like > > > > > simple_pin_... which are completely inimical to namespacing. > > > > > > > > Then how does the networking code handle the namespace stuff in > > > > sysfs? That seems to work today, or am I missing something? > > > > > > have you actually tried? > > > > > > jejb@lingrow:~> sudo unshare --net bash > > > lingrow:/home/jejb # ls /sys/class/net/ > > > lo  tun0  tun10  wlan0 > > > lingrow:/home/jejb # ip link show > > > 1: lo: mtu 65536 qdisc noop state DOWN mode DEFAULT > > > group > > > default qlen 1000 > > >     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 > > > > > > So, as you see, I've entered a network namespace and ip link shows > > > me the only interface I can see in that namespace (a down loopback) > > > but sysfs shows me every interface on the system outside the > > > namespace. > > > > Then all of the code in include/kobject_ns.h is not being used?  We > > have a whole kobject namespace set up for networking, I just assumed > > they were using it.  If not, I'm all for ripping it out. > > Hm, looking at the implementation, it seems to trigger off the > superblock (meaning you have to remount inside a mount namespace) and > it only works to control visibility in label based namespaces, so this > does actually work > > jejb@lingrow:~/git/linux> sudo unshare --net --mount bash > lingrow:/home/jejb # mount -t sysfs none /sys > lingrow:/home/jejb # ls /sys/class/net/ > lo > > The label based approach means that any given file can be shown in one > and only one namespace, which works for net, but not much else > (although it probably could be adapted). Great, thanks for verifying it works properly. No other subsystem other than networking has cared about adding support for namespaces to their sysfs representations. But the base logic is all there if they want to do so. thanks, greg k-h