Article View: linux.kernel.netdev
Article #15795Re: [PATCH RFC 04/41] fs: add SB_I_PSEUDO
From: Alexander Mikhalitsyn
Date: Fri, 13 Nov 2026 10:02
Date: Fri, 13 Nov 2026 10:02
103 lines
15992 bytes
15992 bytes
On Tue, 2026-11-10 at 10:14 +0100, Christian Brauner wrote:
> Currently, there's no way to tell whether the files of a filesystem
> store data or whether they are kernel interfaces. Files on pseudo
> filesystems such as procfs or sysfs generate their contents when
> they're
> read and writes to them are commands to the kernel.
>
> But a few places in the kernel take an arbitrary file and use it as
> storage: loop, zloop, the nvme target's file backend, the scsi
> target's
> fileio backend, fuse passthrough, the usb mass storage gadget and
> erofs
> file-backed mounts. At most they check the file type and whether the
> file implements ->read_iter() and ->write_iter(). That's not enough.
> kernfs provides both for every sysfs attribute for example.
>
> Add SB_I_PSEUDO so a filesystem can state that its regular files are
> kernel interfaces and must not be used as storage.
>
> Pseudo filesystems also never hold executables or device nodes. But
> currently each of them decides on its own whether to raise
> SB_I_NOEXEC
> and SB_I_NODEV. Some do, most don't. Add fc_init_pseudo() as the
> common
> initialization point for all pseudo filesystems that raises all three
> flags and switch init_pseudo() over to it. The following patches
> convert the mountable pseudo filesystems.
>
> Nothing checks SB_I_PSEUDO yet so no functional changes.
>
> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Reviewed-by: Alexander Mikhalitsyn <alex@amutable.com>
> ---
> fs/libfs.c | 2 +-
> include/linux/fs/super_types.h | 1 +
> include/linux/pseudo_fs.h | 11 +++++++++++
> 3 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/fs/libfs.c b/fs/libfs.c
> index 96a6e9b1535f..8c8789489fdf 100644
> --- a/fs/libfs.c
> +++ b/fs/libfs.c
> @@ -735,7 +735,7 @@ struct pseudo_fs_context *init_pseudo(struct
> fs_context *fc,
> fc->fs_private = ctx;
> fc->ops = &pseudo_fs_context_ops;
> fc->sb_flags |= SB_NOUSER;
> - fc->s_iflags |= SB_I_NOEXEC | SB_I_NODEV;
> + fc_init_pseudo(fc);
> fc->global = true;
> }
> return ctx;
> diff --git a/include/linux/fs/super_types.h
> b/include/linux/fs/super_types.h
> index 72f4288e16c5..472200bdf081 100644
> --- a/include/linux/fs/super_types.h
> +++ b/include/linux/fs/super_types.h
> @@ -359,5 +359,6 @@ struct super_block {
> #define SB_I_NOIDMAP 0x00002000 /* No idmapped mounts on
> this superblock */
> #define SB_I_ALLOW_HSM 0x00004000 /* Allow HSM events on this
> superblock */
> #define SB_I_NO_DATA_INTEGRITY 0x00008000 /* fs cannot guarantee
> data persistence on sync */
> +#define SB_I_PSEUDO 0x00010000 /* regular files are kernel
> interfaces, not storage */
>
> #endif /* _LINUX_FS_SUPER_TYPES_H */
> diff --git a/include/linux/pseudo_fs.h b/include/linux/pseudo_fs.h
> index a651e60d9410..0ca408aa60af 100644
> --- a/include/linux/pseudo_fs.h
> +++ b/include/linux/pseudo_fs.h
> @@ -2,6 +2,7 @@
> #define __LINUX_PSEUDO_FS__
>
> #include <linux/fs_context.h>
> +#include <linux/fs/super_types.h>
>
> struct pseudo_fs_context {
> const struct super_operations *ops;
> @@ -15,4 +16,14 @@ struct pseudo_fs_context {
> struct pseudo_fs_context *init_pseudo(struct fs_context *fc,
> unsigned long magic);
>
> +/*
> + * Common initialization for all pseudo filesystems, mountable or
> not. Their
> + * regular files are kernel interfaces. They don't store data and
> pseudo
> + * filesystems never hold executables or device nodes.
> + */
> +static inline void fc_init_pseudo(struct fs_context *fc)
> +{
> + fc->s_iflags |= SB_I_PSEUDO | SB_I_NOEXEC | SB_I_NODEV;
> +}
> +
> #endif
Technical Details
Message-ID:
<f4ce8239f22046e90cf4807853282a570c73707a.camel@amutable.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362529-linux-kernel-netdev=dewy.ruReferences:
<20261110-work-loop-pseudo-v1-0-4c998976c6c7@kernel.org> <20261110-work-loop-pseudo-v1-4-4c998976c6c7@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362529-linux-kernel-netdev=dewy.ru
From: alex@amutable.com (Alexander Mikhalitsyn)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH RFC 04/41] fs: add SB_I_PSEUDO
Date: Fri, 13 Nov 2026 11:02:15 +0100
Organization: Usenet Network
Message-ID: <f4ce8239f22046e90cf4807853282a570c73707a.camel@amutable.com>
References: <20261110-work-loop-pseudo-v1-0-4c998976c6c7@kernel.org>
<20261110-work-loop-pseudo-v1-4-4c998976c6c7@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="1370683"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:MgXk00xttIwMtfhtRQ/jYrmazNo= sha256:VjFo99Xr78unuHdCa/1NczXmmXoaXXYgNhXBXgETYBQ=
sha1:hRSUEzfGVeV+kb9/7dTmzlshnmk= sha256:sD9mp3Aee1nxDdKexDv304QBW+qCQN5TOwQXdxESYVg=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id ABC0211457E; Fri, 13 Nov 2026 18:13:32 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.851
X-Spam-Status: No, score=-1.851 tagged_above=-9999 required=6.31
tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=amutable-com.20260707.gappssmtp.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id DOSgwUJcoMpP;
Fri, 13 Nov 2026 18:13:25 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-362529-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=amutable.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id BD192114576; Fri, 13 Nov 2026 18:13:15 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 277A52D0AA5; Fri, 13 Nov 2026 10:02:28 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1794564141;
b=AmiRXfcjlW3CsnWnXMXwIVTz0yULSEFNLMkBTQD/Jffxj+ty2z8aTIajGSOxfnUso6qU
06FmFNiTmJCxXoMmw9bu0JdSwomYQXrd+3GwsUDjjz0so25BMX9QslRPorqEwBJCFocgs
f5UCzv7fCWnPPyYUL+QZlpf3woZdlQz5UX31TrfMRXsNg4x6uGnzYfk0SemWERxzfHkG8
nQOw/ERkOKTVI1M/cNsOtpiKRe2jrnE7JMvVcSD6aRfS1jdPoacTA9uFgn+M1FVPSlBJL
Tmt5hw8zVMS59woTSTIOn0PLIF/b4x8MqV76H3XzjEBbMBGFVDHkeQaj3x2xG6gx2Vg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794564141;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:Message-ID:Subject:From:To:Cc:Date:
In-Reply-To:References:Content-Type:Content-Transfer-Encoding:
User-Agent:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version;
bh=Ee4ggwaa7pvqsvjnONVsvhhjx7Blw4b1QTFG8P7u7TE=;
b=3dtQue3qrNM70an4os0rylJsf2HD5JNpVVuHmk7HM2n8AW9suMUlD8hPZ1KziOAuiwku
Eb5yRGfM6jkQjIvBIXC3TmuLMD6t+ejfAQe/9G9yqWKh8Fnl5ycoxcS6skFtNqIGU5uSo
FoXiGZeuXJRQp9soeM9Q92ZE1qqjcQh1CUC7cLiVL1mt0QIfNurP8NBH4ZFPe050UFtHH
G7Nbq0xM/STvqvayWth0q2OfR2Scfgbgx1qcmkvPwa9uWPdBq2WVrR93txZZlA3IND7K8
B2SGmjhQd6JzhPnVBihahsoM7FbITY0bvNcVPdw872u/JuafDAhNaulQ8JqBZpbj1Rg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=amutable-com.20260707.gappssmtp.com header.i=@amutable-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=mxnEK0OE;
dmarc=none header.from=amutable.com;
spf=pass smtp.mailfrom=amutable.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C08B606A894;
Fri, 13 Nov 2026 10:02:21 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=amutable-com.20260707.gappssmtp.com header.i=@amutable-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=mxnEK0OE
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.54
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794564140;
b=eqfvnYfOn/85MDywAih5+edTa5536tdgD+g8Ae0NqYVGbq+Vbs6RFEaWgRHAG6EsNuo+
bZ58JI8RYycmtsqEPAhCe4H06RuCj4M+GdKYYoE9+QJNtNGkxNlGOwsG5K3Bj0uKzgcza
aLSl/ZyUadZGTKzjIQxHZjtupZDYg67Yz9mA7vXNP6P3rVH9j9OFmTaRMELW7PtROyzb7
oPtVsKDnAXl1qmmYVfYcr9t9oLBAOEr2lTHhqgbzfSmrs+fIBSMCD/55LgOCYo8KRxAcV
xonTTI5FExRSaVVhTNdQkE8HMkaF8kZyYR416dVRuZi0K28dKfEFvq4ou+6bc6qadmA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794564140;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References:
Content-Type:Content-Transfer-Encoding:User-Agent:MIME-Version;
bh=Ee4ggwaa7pvqsvjnONVsvhhjx7Blw4b1QTFG8P7u7TE=;
b=MLFSDROcODKkurWCu3ds1nO52oSxxL4LLkVli2rFXfor6dzH+7LojMNxff8WhkME+3yT
NUN0f9aGSD6BEcS0gmjYudnHnrjtMntocsFt2qs+sfngfBNMZdAAOiTuPJZdxy2fgEihx
NaIkQ64jtlzxLAr/kEzpg8cKXwZxd3atxzyFN0+lWNNQiA0thqYXplnNxNGBEA9etswa/
/+32HOef+SKzM291nmdfp6UgUN++5ErmrASjfBsI9lTwl6bq/JDsHOORLJsC1k+rKeeXJ
eyFRFIIZgMUxgkJ7meqXWuquefyZGMt3FrjfCtc7JSghX5rdWtMOr0lZ4pi3bzFde/A==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=none header.from=amutable.com;
spf=pass smtp.mailfrom=amutable.com;
dkim=pass header.d=amutable-com.20260707.gappssmtp.com header.i=@amutable-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=mxnEK0OE;
arc=none smtp.remote-ip=209.85.208.54
X-Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6C70606A332
for <netdev@vger.kernel.org>; Fri, 13 Nov 2026 10:02:19 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E6C70606A332
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=amutable.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amutable.com
X-Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-6b7bffb5b8fso1233861a12.3
for <netdev@vger.kernel.org>; Fri, 13 Nov 2026 02:02:19 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=amutable-com.20260707.gappssmtp.com; s=20260707; t=1794564138; x=1795168938; darn=vger.kernel.org;
h=mime-version:user-agent:content-transfer-encoding:content-type
:references:in-reply-to:date:cc:to:from:subject:message-id:from:to
:cc:subject:date:message-id:reply-to:content-type;
bh=Ee4ggwaa7pvqsvjnONVsvhhjx7Blw4b1QTFG8P7u7TE=;
b=mxnEK0OEI7AZoc/CfUYBfL7b57vnPAty4yH1m7TS29a3jfzgxF6O21C+4eoAVH56Q9
piX6TGhock7wjcI74HawyxxvBGzm9YxMDwhPO59HW6wNIzGY38ltasaZh4hFELwGRqEv
EACaW/+rYd6+QPU5/79gIyHIHlnigPDAQAFlfCT0ngxFbKNdFkIgPJ4AQQVbJxYRU4kd
sGda4OaUFoBKprw0qaI3K+cYJzK6vhQ24s+osuqJwxviEyFLXhcz7lQ/DUhHhDlN7iYr
P/EQDWGz9doNbLrGEB0hB+YKjuFHlmGHIGpXLhiZ/HiYA8bpaS50WmEcn/ZjJ0UCEMyu
vVpg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1794564138; x=1795168938;
h=mime-version:user-agent:content-transfer-encoding:content-type
:references:in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=Ee4ggwaa7pvqsvjnONVsvhhjx7Blw4b1QTFG8P7u7TE=;
b=HRTXrWQ3yVDhkLE10+VWs10wG3kND3ljv4oG4MhGCJAjZvqk7Bg/e54vfFth9oa7ow
cocp7kK62V1+heA3POWjnQhfY3vxsSeFQtGwMInzPdWZhjnJM1o9LF1dJM0OcKxn55EM
UZF9Rl4bPGxxMYkzs2APAFLzuzb4khc3BcdSAbAPIhbLNqoVbHtvEUkBPyPh9Pd1bszK
hGCn6MGJmK7GBY4B4xDO7SyRB5l7d1i+3qGRmbipOo0KTB3jQ9sDAqo3YX84DVJzIUFz
mMrzIu57+k01CsRlAWjzo4LiaK0/oDmOTrqIGEfZxQBl0KmOrkVwwvK4WjTWXpqIf2w3
BIZA==
X-Forwarded-Encrypted: i=1; AL+hErHhQFHlfuWLykMG8zOsfhnHbnO0ydezbX17kNc1WwFfJblT/kxGSUwss0NWpl9Lxm3PPryHi5I=@vger.kernel.org
X-Gm-Message-State: APuU4Z+8icDvjfy1dZozEh1t18rirTnBrE+lKMg2m6HrsvNowTJZkcOt
p/4qoz8u7UJjVa7CgAhBhkg82lfO0BAmLT7mm8OKSUDqMCRlnj5Qoreo/Qm67H/OnFjP
X-Gm-Gg: AYBFou2OAgSdCG6RzpiJ+phj8cTpWYpHAQc+aq9d26npJfBG64a+oa79MeySE9M7OUA
wSEKlZ56tbQpGcj04rVw3UKn7DOVk+Jgq/oQqTC6MkAR4jSI56tPEPMXnJn1qDGuGNoisBM5Yg9
kyJiqMPaXWAvbvZykMEn21vTjhZ5djGMZdZaGZXyVo9q54FcxEx+RHQNJK/0OBS/Kr57DBmnGsV
V1+gHfhS+qBIM8Qvbtooik8cJFj9WN7EHZMRsFXo4Z86XefJolUquMShlhJwKA1vq2SVXkkEOgI
9F3PmJR6EP326ZpTSzLWEkR6QLc6CbAeBS1yQkw9DxGIRYtdBFaGzTGSn3gbeHI1dRBnj6FzssT
ji/gQ64XCBBvrjE+cgK6IsaFcwg5dzSSRLjE5pelmd8oEBYWidJjSC8rAo6Gs91a+gu33p1jOlv
BR2HMshr2CkpMsq4AXJAJLyRPxG1Lq8gkgTxTanKzd5rUn6iki99NCgyw9uVLjOP7VbhJnl2hVf
AagGogK40q383TVAK9ChWITouggSWaQlZcBIWRh8Xn9zmDcbDNrtCm+qRn859s5436ARovcNScJ
DojIHUlE81eZ6N3tqzjPMVwK962OZvDvHML6I4jrKRqWC3DEnCGA1oJaZfS2z3g=
X-Received: by 2002:a05:6402:c4e1:10b0:6b6:eefc:ae7a with SMTP id 4fb4d7f45d1cf-6b7c088f8ecmr1236733a12.4.1794564138223;
Fri, 13 Nov 2026 02:02:18 -0800 (PST)
X-Received: from [10.0.0.233] (tmo-086-54.customers.d1-online.com. [80.187.86.54])
by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6b7c23c672asm734155a12.15.2026.11.13.02.02.16
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 13 Nov 2026 02:02:17 -0800 (PST)
X-Cc: Jann Horn <jannh@google.com>, Chris Mason <mason@kernel.org>, Josef
Bacik <josef@toxicpanda.com>, Christoph Hellwig <hch@lst.de>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-nvme@lists.infradead.org, Alexander Viro <viro@zeniv.linux.org.uk>,
Jan Kara <jack@suse.cz>, linux-scsi@vger.kernel.org,
target-devel@vger.kernel.org, driver-core@lists.linux.dev,
linux-mm@kvack.org, bpf@vger.kernel.org,
linux-security-module@vger.kernel.org, selinux@vger.kernel.org,
apparmor@lists.ubuntu.com, linux-nfs@vger.kernel.org,
netdev@vger.kernel.org, fuse-devel@lists.linux.dev,
linux-efi@vger.kernel.org, xen-devel@lists.xenproject.org,
ocfs2-devel@lists.linux.dev, linux-s390@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-usb@vger.kernel.org, Amir Goldstein
<amir73il@gmail.com>, linux-erofs@lists.ozlabs.org,
linux-kselftest@vger.kernel.org
X-In-Reply-To: <20261110-work-loop-pseudo-v1-4-4c998976c6c7@kernel.org>
X-User-Agent: Evolution 3.56.2-0+deb13u1
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list