From patchwork Fri Apr 15 11:02:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yang Xu (Fujitsu)" X-Patchwork-Id: 12814713 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 67B0DC4332F for ; Fri, 15 Apr 2022 10:02:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352043AbiDOKEn (ORCPT ); Fri, 15 Apr 2022 06:04:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352028AbiDOKEm (ORCPT ); Fri, 15 Apr 2022 06:04:42 -0400 Received: from mail1.bemta36.messagelabs.com (mail1.bemta36.messagelabs.com [85.158.142.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E60A7BB096; Fri, 15 Apr 2022 03:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fujitsu.com; s=170520fj; t=1650016932; i=@fujitsu.com; bh=YW2t31SigmRnYDSTgB+T1pJcLO8aD2sH2Tq7Mun3OFc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kx1S6IfwrNptAnxOZNBs2rUbCoMO5nDfeqdG5YaHFBsgvurrQvuK+v5olv357rKsj JGypxZpZP8ykQS6qsfTdQYVukQH765B/w0apyIcBq+vHGZn8y4R/2DCxRlUtZeaM5C nPVH8dEDIDZP/LFCPpe3nzpH0X3feITqsVf/7YLXbqzTf7b4siG6/9bJJzAhVGZW3S HWyruIJcXvHsN4/m1HxD98WLJWtMajmW3pUd1oFz34zRx3bNwcWo8GsHN+0mLxU2zE A91+kcpueuKj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226EJC uu4djTWb19us7VSzbXhd2B2qaymsIv3x4EOHCSeVxef4PXQ6sa++0vvaQRXHbXP7Z7zenbj5W 5ak2tfY2xzqC22UWIozEg21mIuKEwHD8+6ylQMAAA== X-Env-Sender: xuyang2018.jy@fujitsu.com X-Msg-Ref: server-8.tower-532.messagelabs.com!1650016931!56198!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 29816 invoked from network); 15 Apr 2022 10:02:11 -0000 Received: from unknown (HELO n03ukasimr02.n03.fujitsu.local) (62.60.8.146) by server-8.tower-532.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 15 Apr 2022 10:02:11 -0000 Received: from n03ukasimr02.n03.fujitsu.local (localhost [127.0.0.1]) by n03ukasimr02.n03.fujitsu.local (Postfix) with ESMTP id 08451100478; Fri, 15 Apr 2022 11:02:11 +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 EF9B6100471; Fri, 15 Apr 2022 11:02: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; Fri, 15 Apr 2022 11:02:00 +0100 From: Yang Xu To: , , CC: , , , , , , Yang Xu Subject: [PATCH v3 2/7] fs/namei.c: Add missing umask strip in vfs_tmpfile Date: Fri, 15 Apr 2022 19:02:18 +0800 Message-ID: <1650020543-24908-2-git-send-email-xuyang2018.jy@fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1650020543-24908-1-git-send-email-xuyang2018.jy@fujitsu.com> References: <1650020543-24908-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: linux-fsdevel@vger.kernel.org If underflying filesystem doesn't enable own CONFIG_FS_POSIX_ACL, then posix_acl_create can't be called. So we will miss umask strip, ie use ext4 with noacl or disblae CONFIG_EXT4_FS_POSIX_ACL. Reported-by: Christian Brauner (Microsoft) Signed-off-by: Yang Xu Acked-by: Christian Brauner (Microsoft) --- fs/namei.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/namei.c b/fs/namei.c index 3f1829b3ab5b..bbc7c950bbdc 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3521,6 +3521,8 @@ struct dentry *vfs_tmpfile(struct user_namespace *mnt_userns, child = d_alloc(dentry, &slash_name); if (unlikely(!child)) goto out_err; + if (!IS_POSIXACL(dir)) + mode &= ~current_umask(); error = dir->i_op->tmpfile(mnt_userns, dir, child, mode); if (error) goto out_err;