On Mon, Mar 22, 2021 at 03:48:59PM +0100, Miklos Szeredi wrote: minor nit: copy_fsxattr_{to,from}_user() might be better. > +int fsxattr_copy_to_user(const struct miscattr *ma, struct fsxattr __user *ufa) > +{ > + struct fsxattr fa = { > + .fsx_xflags = ma->fsx_xflags, > + .fsx_extsize = ma->fsx_extsize, > + .fsx_nextents = ma->fsx_nextents, > + .fsx_projid = ma->fsx_projid, > + .fsx_cowextsize = ma->fsx_cowextsize, > + }; That wants a comment along the lines of "guaranteed to be gap-free", since otherwise you'd need memset() to avoid an infoleak. > +static int ioctl_getflags(struct file *file, void __user *argp) > +{ > + struct miscattr ma = { .flags_valid = true }; /* hint only */ > + unsigned int flags; > + int err; > + > + err = vfs_miscattr_get(file_dentry(file), &ma); Umm... Just to clarify - do we plan to have that ever called via ovl_real_ioctl()? IOW, is file_dentry() anything other than a way to spell ->f_path.dentry here? > +struct miscattr { > + u32 flags; /* flags (FS_IOC_GETFLAGS/FS_IOC_SETFLAGS) */ > + /* struct fsxattr: */ > + u32 fsx_xflags; /* xflags field value (get/set) */ > + u32 fsx_extsize; /* extsize field value (get/set)*/ > + u32 fsx_nextents; /* nextents field value (get) */ > + u32 fsx_projid; /* project identifier (get/set) */ > + u32 fsx_cowextsize; /* CoW extsize field value (get/set)*/ > + /* selectors: */ > + bool flags_valid:1; > + bool xattr_valid:1; > +}; OK as long as it stays kernel-only, but if we ever expose that to userland, we'd better remember to turn the last two into an u32 with explicit bitmasks.