On Tue, 2026-11-10 at 10:14 +0100, Christian Brauner wrote:
> Initialize all kernfs based filesystems as pseudo filesystems in
> kernfs_get_tree() instead of raising SB_I_NOEXEC and SB_I_NODEV by
> hand
> in kernfs_fill_super(). This adds SB_I_PSEUDO for sysfs, cgroupfs and
> resctrl.
> 
> Signed-off-by: Christian Brauner (Amutable) <[email protected]>

Reviewed-by: Alexander Mikhalitsyn <[email protected]>

> ---
>  fs/kernfs/mount.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
> index a0be784bfb06..6b60d212b003 100644
> --- a/fs/kernfs/mount.c
> +++ b/fs/kernfs/mount.c
> @@ -8,6 +8,7 @@
>   */
>  
>  #include <linux/fs.h>
> +#include <linux/pseudo_fs.h>
>  #include <linux/mount.h>
>  #include <linux/init.h>
>  #include <linux/magic.h>
> @@ -298,8 +299,6 @@ static int kernfs_fill_super(struct super_block
> *sb, struct kernfs_fs_context *k
>       struct dentry *root;
>  
>       info->sb = sb;
> -     /* Userspace would break if executables or devices appear on
> sysfs */
> -     sb->s_iflags |= SB_I_NOEXEC | SB_I_NODEV;
>       sb->s_blocksize = PAGE_SIZE;
>       sb->s_blocksize_bits = PAGE_SHIFT;
>       sb->s_magic = kfc->magic;
> @@ -388,6 +387,7 @@ int kernfs_get_tree(struct fs_context *fc)
>       info->ns = kfc->ns_tag;
>       INIT_LIST_HEAD(&info->node);
>  
> +     fc_init_pseudo(fc);
>       fc->s_fs_info = info;
>       sb = sget_fc(fc, kernfs_test_super, kernfs_set_super);
>       if (IS_ERR(sb))

Reply via email to