[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 051/104] virtiofsd: Parse flag FUSE_WRITE_KILL_PRIV
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [PATCH 051/104] virtiofsd: Parse flag FUSE_WRITE_KILL_PRIV |
Date: |
Wed, 15 Jan 2020 14:34:56 +0000 |
User-agent: |
Mutt/1.13.0 (2019-11-30) |
* Misono Tomohiro (address@hidden) wrote:
> > From: Vivek Goyal <address@hidden>
> >
> > Caller can set FUSE_WRITE_KILL_PRIV in write_flags. Parse it and pass it
> > to the filesystem.
> >
> > Signed-off-by: Vivek Goyal <address@hidden>
> > ---
> > tools/virtiofsd/fuse_common.h | 6 +++++-
> > tools/virtiofsd/fuse_lowlevel.c | 4 +++-
> > 2 files changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/virtiofsd/fuse_common.h b/tools/virtiofsd/fuse_common.h
> > index 147c043bd9..1e8191b7a6 100644
> > --- a/tools/virtiofsd/fuse_common.h
> > +++ b/tools/virtiofsd/fuse_common.h
> > @@ -93,8 +93,12 @@ struct fuse_file_info {
> > */
> > unsigned int cache_readdir:1;
> >
> > + /* Indicates that suid/sgid bits should be removed upon write */
> > + unsigned int kill_priv:1;
> > +
> > +
> > /** Padding. Reserved for future use*/
> > - unsigned int padding:25;
> > + unsigned int padding:24;
> > unsigned int padding2:32;
> >
> > /*
> > diff --git a/tools/virtiofsd/fuse_lowlevel.c
> > b/tools/virtiofsd/fuse_lowlevel.c
> > index bd5ca2f157..c8a3b1597a 100644
> > --- a/tools/virtiofsd/fuse_lowlevel.c
> > +++ b/tools/virtiofsd/fuse_lowlevel.c
> > @@ -1144,6 +1144,7 @@ static void do_write(fuse_req_t req, fuse_ino_t
> > nodeid,
> > memset(&fi, 0, sizeof(fi));
> > fi.fh = arg->fh;
> > fi.writepage = (arg->write_flags & FUSE_WRITE_CACHE) != 0;
> > + fi.kill_priv = !!(arg->write_flags & FUSE_WRITE_KILL_PRIV);
> >
> > fi.lock_owner = arg->lock_owner;
> > fi.flags = arg->flags;
> > @@ -1179,7 +1180,8 @@ static void do_write_buf(fuse_req_t req, fuse_ino_t
> > nodeid,
> > fi.lock_owner = arg->lock_owner;
> > fi.flags = arg->flags;
> > fi.fh = arg->fh;
> > - fi.writepage = arg->write_flags & FUSE_WRITE_CACHE;
> > + fi.writepage = !!(arg->write_flags & FUSE_WRITE_CACHE);
> > + fi.kill_priv = !!(arg->write_flags & FUSE_WRITE_KILL_PRIV);
> >
> > if (ibufv->count == 1) {
> > assert(!(tmpbufv.buf[0].flags & FUSE_BUF_IS_FD));
> > --
> > 2.23.0
>
> Reviewed-by: Misono Tomohiro <address@hidden>
Thank you.
> side-note: virtiofs uses write_buf() and therefore do_write() is never called.
> How about cleanup the function?
Yes I think you're right; I need to go through and check there's no
corner case which can get into the plain do_write.
Dave
>
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK