From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A4C520DD48 for ; Thu, 16 Oct 2025 15:43:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760629392; cv=none; b=HXeweF+yzswVjYqu8KW8MwQOO4mVPte6WZWTyvz4Z/0Lo1ptWIkz6DVJ+oZIa1Wu3iWOhT/dpc7JHFYr9Qizv9u0st1HFBrHx1mFp8R7sfPjElEtH8Vde/umQ5/d5dx4BKGJelucx+TO1ptIopLBgAbX+zjB+voTtvW31+b0Ln4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760629392; c=relaxed/simple; bh=A5cdithFxkgN33kLpZj+SoVkf2QQFRVDzfNb4iGNPp0=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AuBRRX+l+hCgsD8rb/2rild8fGV3dbHxU+QQIYtU+0FRFrz4awY9hZHl2x82jeMqk8fucaWWHPWlTcK3btQiX/ddpvayBl/j0v+i1VFwYv008ALqHDotKw7Pj76Id1k6+M8Vy00wYogOinwYhSJIn2TB+AjMOS1ArUua6ujJf0M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qJoGTDBo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qJoGTDBo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E666EC4CEF1; Thu, 16 Oct 2025 15:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760629392; bh=A5cdithFxkgN33kLpZj+SoVkf2QQFRVDzfNb4iGNPp0=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=qJoGTDBoZyjucN/EaRD6zLkMuBgqV5eZI/5yhDj6PeD3Uq7XeRIwqJW8n9MYasJr+ Oi1ydzUPqC0YVA4+4dwrr5L9zrXnPqRA42h06YNFcNYxYb2VlRMHvkHv7oKKLeJkFO bT766JK9MQvSqqK0BHeENeMX85/rAvdp1L/StST5dF1rsDLbLsG30RsP3Xo6QDCY/9 m0GzqUUt8aVhntp+pDqeKD9cHMCpmv4Jx7ER7yzV6mCtUWkmhvM4WGai/qXCAH8dWW S6OHd6+Han9QQUbUw/Y5TZs7MHvcqXhLWwCC51fQIaR/gd5EIF8gXwqEGEvR32Utj8 nEe/hgLvdUkcw== Date: Thu, 16 Oct 2025 08:43:11 -0700 Subject: [PATCH 13/16] fuse2fs: fix in_file_group missing the primary process gid From: "Darrick J. Wong" To: tytso@mit.edu Cc: linux-ext4@vger.kernel.org, linux-ext4@vger.kernel.org Message-ID: <176062915701.3343688.8714211042480698391.stgit@frogsfrogsfrogs> In-Reply-To: <176062915393.3343688.9810444125172113159.stgit@frogsfrogsfrogs> References: <176062915393.3343688.9810444125172113159.stgit@frogsfrogsfrogs> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit From: Darrick J. Wong 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: # v1.47.3 Fixes: 3469e6ff606af8 ("fuse2fs: fix group membership checking in op_chmod") Signed-off-by: "Darrick J. Wong" --- misc/fuse2fs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c index 0ecdd4f9e93225..b8db298cde202f 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;