Re: [PATCH v2 20/21] fuse: use passthrough getattr in setattr suid/sgid handling
Joanne Koong <[email protected]> Fri, 15 May 2026 18:20:45 -0700
| Newsgroups | org.kernel.vger.linux-unionfs,dev.linux.lists.fuse-devel |
|---|---|
| Message-ID | <CAJnrk1a9_MLyMebfsDe_=Rcd2+TaiD87pW4fd4ve8ZBQPCfGcQ@mail.gmail.com> |
On Fri, May 15, 2026 at 5:53 PM Joanne Koong <[email protected]> wrote: > > When refreshing i_mode for suid/sgid kill during setattr, use > passthrough getattr if the inode has that enabled. > > Signed-off-by: Joanne Koong <[email protected]> > --- > fs/fuse/dir.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c > index b67b3b334e69..fd1b3fd86968 100644 > --- a/fs/fuse/dir.c > +++ b/fs/fuse/dir.c > @@ -2524,7 +2524,11 @@ static int fuse_setattr(struct mnt_idmap *idmap, struct dentry *entry, > * ia_mode calculation may have used stale i_mode. > * Refresh and recalculate. > */ > - ret = fuse_do_getattr(idmap, inode, NULL, file); > + if (fuse_passthrough_op(inode, FUSE_GETATTR)) > + ret = fuse_passthrough_getattr(inode, NULL, > + STATX_MODE, 0); > + else > + ret = fuse_do_getattr(idmap, inode, NULL, file); I left this part untouched from v1 but there was a discussion [1] about whether to enforce that setattr must be passed through if getattr is passed through [1]. I think there might be some use cases though where having only getattr passed through and not setattr is useful (eg server wants fast stat() but needs to intercept attribute changes for access control or policy enforcement). I'm not sure if you still feel it's better to keep it simple with enforcing that getattr+setattr rmust always be passed through together, Amir, but if so I'm happy to add that in. Thanks, Joanne [1] https://lore.kernel.org/fuse-devel/CAOQ4uxg7jaA0FdLW6uzZBRX=m1Xw4v-k7zeQx7kYcpFwFDpf7A@mail.gmail.com/ > if (ret) > return ret; > > -- > 2.52.0 >