From patchwork Thu Apr 21 07:54:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Xu X-Patchwork-Id: 564456 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF9E2C433EF for ; Thu, 21 Apr 2022 06:55:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385388AbiDUG6b (ORCPT ); Thu, 21 Apr 2022 02:58:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385489AbiDUG5G (ORCPT ); Thu, 21 Apr 2022 02:57:06 -0400 Received: from mail1.bemta32.messagelabs.com (mail1.bemta32.messagelabs.com [195.245.230.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6E6E15A2C; Wed, 20 Apr 2022 23:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1650524052; i=@fujitsu.com; bh=Tzs2F8+0DEjTwEaGrFc3SQdIHq8vdHXoRQd3UlmB4t8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Kk+2svfqG4dXOjjngB0W6PWR4WlqURmkUJEFsCS4vOmhsPBv7cFk3r2yv1pCyTjIh UA7GlzboV/wwU+WicaIbnqbCzA+jORyrl1byk4lFJ6l8lbpvzTi9tnshjeq7o+MmRO 61gqLBCta4zuU78RURI0vol6fPej+hmO1uWe32+lQ/qtF2zYUbSIeOcgqPrbjwAm6H oOWpLoFpCRsgNyHLNzTYTLzFyhMq87TBTR19Cc0/aLk1qZKF6kIyOfwz+gWtHaLnjQ bmrsZuOdatlF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z O/b/2iqhvmj5ObEeZ8WtwuuOcaV+O1RfrFJim2ihEX5vzeMbZhOmfZPsWzVX63BaUE/68drwF S+NpiixFGckGmoxFxUnAgDVLxvtkAMAAA== X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-3.tower-587.messagelabs.com!1650524051!11495!1 X-Originating-IP: [62.60.8.146] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.85.8; banners=-,-,- X-VirusChecked: Checked Received: (qmail 24026 invoked from network); 21 Apr 2022 06:54:11 -0000 Received: from unknown (HELO n03ukasimr02.n03.fujitsu.local) (62.60.8.146) by server-3.tower-587.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 21 Apr 2022 06:54:11 -0000 Received: from n03ukasimr02.n03.fujitsu.local (localhost [127.0.0.1]) by n03ukasimr02.n03.fujitsu.local (Postfix) with ESMTP id F22A410045E; Thu, 21 Apr 2022 07:54:10 +0100 (BST) Received: from R01UKEXCASM126.r01.fujitsu.local (unknown [10.183.43.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by n03ukasimr02.n03.fujitsu.local (Postfix) with ESMTPS id E167E100478; Thu, 21 Apr 2022 07:54:10 +0100 (BST) Received: from localhost.localdomain (10.167.220.84) by R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Thu, 21 Apr 2022 07:53:57 +0100 From: Yang Xu To: , CC: , , , , , , Yang Xu Subject: [PATCH v5 4/4] ceph: Remove S_ISGID clear code in ceph_finish_async_create Date: Thu, 21 Apr 2022 15:54:18 +0800 Message-ID: <1650527658-2218-4-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1650527658-2218-1-git-send-email-xuyang2018.jy@fujitsu.com> References: <1650527658-2218-1-git-send-email-xuyang2018.jy@fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.220.84] X-ClientProxiedBy: G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) To R01UKEXCASM126.r01.fujitsu.local (10.183.43.178) X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Since vfs has stripped S_ISGID in the previous patch, the calltrace as below: vfs: lookup_open ... if (open_flag & O_CREAT) { if (open_flag & O_EXCL) open_flag &= ~O_TRUNC; mode = prepare_mode(mnt_userns, dir->d_inode, mode); ... dir_inode->i_op->atomic_open ceph: ceph_atomic_open ... if (flags & O_CREAT) ceph_finish_async_create We have stripped sgid in prepare_mode, so remove this useless clear code directly. Signed-off-by: Yang Xu Reviewed-by: Christian Brauner (Microsoft) Reviewed-by: Xiubo Li --- fs/ceph/file.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 6c9e837aa1d3..8e3b99853333 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -651,10 +651,6 @@ static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry, /* Directories always inherit the setgid bit. */ if (S_ISDIR(mode)) mode |= S_ISGID; - else if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP) && - !in_group_p(dir->i_gid) && - !capable_wrt_inode_uidgid(&init_user_ns, dir, CAP_FSETID)) - mode &= ~S_ISGID; } else { in.gid = cpu_to_le32(from_kgid(&init_user_ns, current_fsgid())); }