From: xiubli@redhat.com
To: miklos@szeredi.hu
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Xiubo Li <xiubli@redhat.com>
Subject: [PATCH] fuse: pass ATTR_KILL_SUID/ATTR_KILL_SGID mode bits to user space
Date: Thu, 21 Sep 2023 10:24:36 +0800 [thread overview]
Message-ID: <20230921022436.1191166-1-xiubli@redhat.com> (raw)
From: Xiubo Li <xiubli@redhat.com>
Such as for the xfstest-dev's generic/684 test case it will clear
suid and sgid if the fallocate request is commit by an unprivileged
user.
We need to pass the ATTR_KILL_SUID/ATTR_KILL_SGID flags to userspace.
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
fs/fuse/dir.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index f67bef9d83c4..73dcf54efbff 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1938,11 +1938,11 @@ static int fuse_setattr(struct mnt_idmap *idmap, struct dentry *entry,
attr->ia_mode = inode->i_mode;
if (inode->i_mode & S_ISUID) {
- attr->ia_valid |= ATTR_MODE;
+ attr->ia_valid |= ATTR_KILL_SUID | ATTR_MODE;
attr->ia_mode &= ~S_ISUID;
}
if ((inode->i_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
- attr->ia_valid |= ATTR_MODE;
+ attr->ia_valid |= ATTR_KILL_SGID | ATTR_MODE;
attr->ia_mode &= ~S_ISGID;
}
}
--
2.41.0
next reply other threads:[~2023-09-21 2:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-21 2:24 xiubli [this message]
2023-10-07 7:50 ` [PATCH] fuse: pass ATTR_KILL_SUID/ATTR_KILL_SGID mode bits to user space Xiubo Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230921022436.1191166-1-xiubli@redhat.com \
--to=xiubli@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).