[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 053/111] virtiofsd: Parse flag FUSE_WRITE_KILL_PRIV
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 053/111] virtiofsd: Parse flag FUSE_WRITE_KILL_PRIV |
Date: |
Thu, 23 Jan 2020 11:57:43 +0000 |
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>
Reviewed-by: Misono Tomohiro <address@hidden>
Reviewed-by: Sergio Lopez <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <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 f8f6433743..686c42c0a5 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 02e1d83038..2d6dc5a680 100644
--- a/tools/virtiofsd/fuse_lowlevel.c
+++ b/tools/virtiofsd/fuse_lowlevel.c
@@ -1142,6 +1142,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;
@@ -1177,7 +1178,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.24.1
- [PULL 042/111] virtiofsd: Pass write iov's all the way through, (continued)
- [PULL 042/111] virtiofsd: Pass write iov's all the way through, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 043/111] virtiofsd: add fuse_mbuf_iter API, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 040/111] virtiofsd: validate path components, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 041/111] virtiofsd: Plumb fuse_bufvec through to do_write_buf, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 039/111] virtiofsd: passthrough_ll: add fallback for racy ops, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 044/111] virtiofsd: validate input buffer sizes in do_write_buf(), Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 047/111] virtiofsd: prevent ".." escape in lo_do_readdir(), Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 046/111] virtiofsd: prevent ".." escape in lo_do_lookup(), Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 048/111] virtiofsd: use /proc/self/fd/ O_PATH file descriptor, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 049/111] virtiofsd: sandbox mount namespace, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 053/111] virtiofsd: Parse flag FUSE_WRITE_KILL_PRIV,
Dr. David Alan Gilbert (git) <=
- [PULL 052/111] virtiofsd: add seccomp whitelist, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 045/111] virtiofsd: check input buffer size in fuse_lowlevel.c ops, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 051/111] virtiofsd: move to a new pid namespace, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 054/111] virtiofsd: cap-ng helpers, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 050/111] virtiofsd: move to an empty network namespace, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 055/111] virtiofsd: Drop CAP_FSETID if client asked for it, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 057/111] virtiofsd: fix libfuse information leaks, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 058/111] docs: Add docs/tools, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 059/111] virtiofsd: add security guide document, Dr. David Alan Gilbert (git), 2020/01/23
- [PULL 056/111] virtiofsd: set maximum RLIMIT_NOFILE limit, Dr. David Alan Gilbert (git), 2020/01/23