Re: [PATCH RFC 14/41] debugfs: use fc_init_pseudo()
From: Jan Kara
Date: Tue Nov 10 2026 - 08:17:38 EST
On Tue 10-11-26 10:14:30, Christian Brauner wrote:
> Initialize debugfs as a pseudo filesystem. This raises SB_I_PSEUDO and
> also SB_I_NOEXEC and SB_I_NODEV. debugfs never holds executables or
> device nodes.
>
> SB_I_NOEXEC also refuses PROT_EXEC mappings. The debugfs files that
> can be mapped, kcov, relay channels and powernv's memtrace, map data.
>
> Signed-off-by: Christian Brauner (Amutable) <brauner@xxxxxxxxxx>
OK, makes sense. Feel free to add:
Reviewed-by: Jan Kara <jack@xxxxxxx>
Honza
> ---
> fs/debugfs/inode.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
> index b4915551ad31..f163f0bc5703 100644
> --- a/fs/debugfs/inode.c
> +++ b/fs/debugfs/inode.c
> @@ -15,6 +15,7 @@
> #include <linux/module.h>
> #include <linux/fs.h>
> #include <linux/fs_context.h>
> +#include <linux/pseudo_fs.h>
> #include <linux/fs_parser.h>
> #include <linux/pagemap.h>
> #include <linux/init.h>
> @@ -317,6 +318,7 @@ static int debugfs_init_fs_context(struct fs_context *fc)
> fsi->mode = DEBUGFS_DEFAULT_MODE;
>
> fc->s_fs_info = fsi;
> + fc_init_pseudo(fc);
> fc->ops = &debugfs_context_ops;
> return 0;
> }
>
> --
> 2.53.0
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR