On Fri, Jul 18, 2025 at 04:10:18PM +0200, Amir Goldstein wrote: > On Fri, Jul 18, 2025 at 1:36 AM Darrick J. Wong <djwong@xxxxxxxxxx> wrote: > > > > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > > > Create new fuse_reply_{attr,create,entry}_iflags functions so that we > > can send FUSE_ATTR_* flags to the kernel when instantiating an inode. > > Servers are expected to send FUSE_IFLAG_* values, which will be > > translated into what the kernel can understand. > > > > Signed-off-by: "Darrick J. Wong" <djwong@xxxxxxxxxx> > > --- > > include/fuse_common.h | 3 ++ > > include/fuse_lowlevel.h | 87 +++++++++++++++++++++++++++++++++++++++++++++-- > > lib/fuse_lowlevel.c | 69 ++++++++++++++++++++++++++++++------- > > lib/fuse_versionscript | 4 ++ > > 4 files changed, 146 insertions(+), 17 deletions(-) <snip for brevity> > > diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c > > index d26043fa54c036..568db13502a7d7 100644 > > --- a/lib/fuse_lowlevel.c > > +++ b/lib/fuse_lowlevel.c > > @@ -545,7 +573,22 @@ int fuse_reply_attr(fuse_req_t req, const struct stat *attr, > > memset(&arg, 0, sizeof(arg)); > > arg.attr_valid = calc_timeout_sec(attr_timeout); > > arg.attr_valid_nsec = calc_timeout_nsec(attr_timeout); > > - convert_stat(attr, &arg.attr); > > + convert_stat(attr, &arg.attr, 0); > > + > > + return send_reply_ok(req, &arg, size); > > +} > > + > > +int fuse_reply_attr_iflags(fuse_req_t req, const struct stat *attr, > > + unsigned int iflags, double attr_timeout) > > +{ > > + struct fuse_attr_out arg; > > + size_t size = req->se->conn.proto_minor < 9 ? > > + FUSE_COMPAT_ATTR_OUT_SIZE : sizeof(arg); > > + > > + memset(&arg, 0, sizeof(arg)); > > + arg.attr_valid = calc_timeout_sec(attr_timeout); > > + arg.attr_valid_nsec = calc_timeout_nsec(attr_timeout); > > + convert_stat(attr, &arg.attr, iflags); > > > > return send_reply_ok(req, &arg, size); > > } > > I wonder why fuse_reply_attr() is not implemented as a wrapper to > fuse_reply_attr_iflags()? oops. I meant to convert this one, and apparently forgot. :( > FWIW, the flags field was added in minor version 23 for > FUSE_ATTR_SUBMOUNT, but I guess that doesn't matter here. <nod> Hopefully nobody will call fuse_reply_attr_iflags when proto_minor < 23. Do I need to check for that explicitly in libfuse and zero out iflags? Or is it safe enough to assume that the os kernel ignores flags bits that it doesn't understand and/or are not enabled on the fuse_mount? (I'm not sure if the lowlevel fuse library exists on mac/bsdfuse, though afaict they ship the same source code so ... probably?) Also: how aggressively do the syzbot people go after /dev/fuse? --D > Thanks, > Amir. >