Re: [PATCH 05/33] xfs: remove the ATTR_INCOMPLETE flag

Christoph Hellwig
2019-12-24T11:59:55Z

On Wed, Dec 18, 2019 at 01:43:09PM -0800, Darrick J. Wong wrote:
> > diff --git a/fs/xfs/libxfs/xfs_attr.h b/fs/xfs/libxfs/xfs_attr.h
> > index 91c2cb14276e..04a628016728 100644
> > --- a/fs/xfs/libxfs/xfs_attr.h
> > +++ b/fs/xfs/libxfs/xfs_attr.h
> > @@ -36,11 +36,10 @@ struct xfs_attr_list_context;
> > #define ATTR_KERNOTIME 0x1000 /* [kernel] don't update inode timestamps */
> > #define ATTR_KERNOVAL 0x2000 /* [kernel] get attr size only, not value */
> >
> > -#define ATTR_INCOMPLETE 0x4000 /* [kernel] return INCOMPLETE attr keys */
>
> Hmm, did we used to allow ATTR_INCOMPLETE from the attr_multi userspace
> calls?

We allowed that, but it didn't do anything as only the attr list code
checked for ATTR_INCOMPLETE.

> Maybe we should leave ATTR_INCOMPLETE so that we can blacklist
> it in case we ever see it coming from userspace? Or at least prevent
> anyone from reusing 0x4000 and suffering the confusion.

At then end of the series the whole flags mess is cleaned up and there
is a hard barrier from user to kernel flags, so this should all be set.

> I also wonder if we can break userspace this way, but OTOH userspace
> should never be able to query incomplete attrs and this is an obscure
> ioctl anyway so maybe it's fine....

Exactly. Incomplete attrs are an implementation detail that must not leak
to userspace.