[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <175797569799.245695.16735941049251169393.stgit@frogsfrogsfrogs>
Date: Mon, 15 Sep 2025 15:40:19 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: linux-ext4@...r.kernel.org, linux-ext4@...r.kernel.org
Subject: [PATCH 10/12] fuse2fs: fix in_file_group missing the primary process
gid
From: Darrick J. Wong <djwong@...nel.org>
I forgot that Unix processes have both a primary group id and a list of
supplementary group ids. The primary is provided by the fuse client;
the supplemental groups are noted by the Groups: field of
/proc/self/status.
If a process does not have /any/ supplemental group ids, then
in_file_group returns the wrong answer if the inode gid matches the
group id provided by the fuse client because it doesn't check that
anymore. Make it so the primary group id check always happens.
Found by generic/375.
Cc: <linux-ext4@...r.kernel.org> # v1.47.3
Fixes: 3469e6ff606af8 ("fuse2fs: fix group membership checking in op_chmod")
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
misc/fuse2fs.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index a075e3055bd743..7ec7875d9108a2 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -2303,10 +2303,14 @@ static int in_file_group(struct fuse_context *ctxt,
gid_t gid = inode_gid(*inode);
int ret;
+ /* If the inode gid matches the process' primary group, we're done. */
+ if (ctxt->gid == gid)
+ return 1;
+
ret = get_req_groups(ff, &gids, &nr_gids);
if (ret == -ENOENT) {
/* magic return code for "could not get caller group info" */
- return ctxt->gid == inode_gid(*inode);
+ return 0;
}
if (ret < 0)
return ret;
Powered by blists - more mailing lists