[PATCH v3 04/38] fs: add mount_setattr()

Christoph Hellwig hch at lst.de
Wed Dec 2 09:47:51 UTC 2020


On Wed, Dec 02, 2020 at 10:42:18AM +0100, Christian Brauner wrote:
> > > +	if (upper_32_bits(attr->attr_set))
> > > +		return -EINVAL;
> > > +	if (build_attr_flags(lower_32_bits(attr->attr_set), &kattr->attr_set))
> > > +		return -EINVAL;
> > > +
> > > +	if (upper_32_bits(attr->attr_clr))
> > > +		return -EINVAL;
> > > +	if (build_attr_flags(lower_32_bits(attr->attr_clr), &kattr->attr_clr))
> > > +		return -EINVAL;
> > 
> > What is so magic about the upper and lower 32 bits?
> 
> Nothing apart from the fact that they arent't currently valid. I can
> think about reworking these lines. Or do you already have a preferred
> way of doing this in mind?

Just turn the attr_flags argument to build_attr_flags into a u64 and
the first sanity check there will catch all invalid flags, no matter
where they are places.  That should also generate more efficient code.



More information about the Linux-security-module-archive mailing list