Re: [PATCH RFC 09/41] bpf: use fc_init_pseudo() for bpffs

From: Alexander Mikhalitsyn

Date: Fri Nov 13 2026 - 10:32:45 EST


On Tue, 2026-11-10 at 10:14 +0100, Christian Brauner wrote:
> Initialize bpffs as a pseudo filesystem instead of raising
> SB_I_NOEXEC and SB_I_NODEV by hand. This adds SB_I_PSEUDO.
>
> Signed-off-by: Christian Brauner (Amutable) <brauner@xxxxxxxxxx>

Reviewed-by: Alexander Mikhalitsyn <alex@xxxxxxxxxxxx>

> ---
>  kernel/bpf/inode.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c
> index c6f328e4752e..57cf3775c076 100644
> --- a/kernel/bpf/inode.c
> +++ b/kernel/bpf/inode.c
> @@ -15,6 +15,7 @@
>  #include <linux/namei.h>
>  #include <linux/fs.h>
>  #include <linux/fs_context.h>
> +#include <linux/pseudo_fs.h>
>  #include <linux/fs_parser.h>
>  #include <linux/kdev_t.h>
>  #include <linux/filter.h>
> @@ -1197,8 +1198,6 @@ static int bpf_fill_super(struct super_block
> *sb, struct fs_context *fc)
>   sb->s_magic = BPF_FS_MAGIC;
>   sb->s_op = &bpf_super_ops;
>   sb->s_xattr = bpf_fs_xattr_handlers;
> - sb->s_iflags |= SB_I_NOEXEC;
> - sb->s_iflags |= SB_I_NODEV;
>   sb->s_time_gran = 1;
>  
>   inode = bpf_get_inode(sb, NULL, S_IFDIR | 0777);
> @@ -1261,6 +1260,7 @@ static int bpf_init_fs_context(struct
> fs_context *fc)
>   opts->delegate_attachs = 0;
>  
>   fc->s_fs_info = opts;
> + fc_init_pseudo(fc);
>   fc->ops = &bpf_context_ops;
>   return 0;
>  }