Re: [PATCH] secretmem: use SB_I_NOEXEC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 07, 2025 at 06:17:35PM +0100, Al Viro wrote:
> 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?

Seemed cleaner to do it the other way around and get rid of the ? while
at it. I don't think it matters either way.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux