Re: [PATCH] secretmem: use SB_I_NOEXEC
From: Al Viro
Date: Mon Jul 07 2025 - 13:17:51 EST
On Mon, Jul 07, 2025 at 02:10:36PM +0200, Christian Brauner wrote:
> static int secretmem_init_fs_context(struct fs_context *fc)
> {
> - return init_pseudo(fc, SECRETMEM_MAGIC) ? 0 : -ENOMEM;
> + struct pseudo_fs_context *ctx;
> +
> + ctx = init_pseudo(fc, SECRETMEM_MAGIC);
> + if (!ctx)
> + return -ENOMEM;
> +
> + fc->s_iflags |= SB_I_NOEXEC;
> + fc->s_iflags |= SB_I_NODEV;
> + return 0;
> }
What's the point of doing that *after* init_pseudo()? IOW, why not simply
static int secretmem_init_fs_context(struct fs_context *fc)
{
fc->s_iflags |= SB_I_NOEXEC;
fc->s_iflags |= SB_I_NODEV;
return init_pseudo(fc, SECRETMEM_MAGIC) ? 0 : -ENOMEM;
}
seeing that init_pseudo() won't undo those?