[Virtio-fs] [PATCH 4/5] fuse: For sending setattr in case of open(O_TRUNC)
Vivek Goyal
vgoyal at redhat.com
Fri Jul 24 18:38:11 UTC 2020
open(O_TRUNC) will not kill suid/sgid on server and fuse_open_in does not
have information if caller has CAP_FSETID or not.
So force sending setattr() which is called after open(O_TRUNC) so that
server clears setuid/setgid.
Signed-off-by: Vivek Goyal <vgoyal at redhat.com>
---
fs/fuse/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 82747ca4c5c8..0572779abbbe 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1516,7 +1516,7 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr,
/* This is coming from open(..., ... | O_TRUNC); */
WARN_ON(!(attr->ia_valid & ATTR_SIZE));
WARN_ON(attr->ia_size != 0);
- if (fc->atomic_o_trunc) {
+ if (fc->atomic_o_trunc && !fc->handle_killpriv_v2) {
/*
* No need to send request to userspace, since actual
* truncation has already been done by OPEN. But still
--
2.25.4
More information about the Virtio-fs
mailing list