Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp938688rdg; Wed, 11 Oct 2023 09:29:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHKryNE5XGQkhSg3CEpa2F494whsT5DRdjFlyfCAcf2YQIyuoAuca64NzobOK2+R0JINBOv X-Received: by 2002:a05:6870:2198:b0:1c1:e6da:f88d with SMTP id l24-20020a056870219800b001c1e6daf88dmr25192081oae.56.1697041778478; Wed, 11 Oct 2023 09:29:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697041778; cv=none; d=google.com; s=arc-20160816; b=q4ZA/meDBe6f8PZy67mZEJmVKmZRvgLCAgFmaZKOiCkiXjeUldLrfWiG89rKKKm9I0 VP3wNxcz2uz4RVQKI2OPHOyrnwOgse6LDTiWkjDr1XcpxtMWGAOKTv5ZoIFrsZgcd6uj l8Qn3sIcboAB8/CK7sukVvV53dleQe7Xsw+SO2ILU7xB2sZjxIyd/71ueRvLTP/vecYI 7V0rqr8JpRClnEhyclxZQlC1DGdHQM9ZZrGtaaszDeb0/wVFYHoXvq6TkzllyIBZRg6m SeEd9LoPkvMsH4eg2pjPE261aLIhl35DwMiWd8Z8hWHwYhUnu1aZISPgGWlDSkzF/KJ2 i+fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=kYo77x54AzSd+UJL48y6CRA7yZ5+4RMlae1FSxp7kUY=; fh=SDfuQtPJuK0lsTTwAeQAXcq0/5aMDT3UDqgke0za7cY=; b=Sof0nW0cc/8jL+tZxiwH3ZJhgdhyYFZZ3Js3nqC8BBbsmR5DrC0ryJWz8Q/1VORKhx 0ytHRjCh0tqLqQU1myO09BHYSFufhRVuqgkWrqB4qcUSvfbcOUrxPFl6rsWhI2WV1SKu h+R8ZhTfB25MJc0B7iUBpkI4nVPDzaenXRusFe8h0eW2Jlp0dTHhRpcz/otyYjOU0wwl WOmHRwX79ZRklOQmxsXz8tOD0N+MtE5cDU+VHKSP0PZNznAsYwj7JAbhQvOfeCzVCQ9Y LX5nhwZaEjLFypqbkHufMjExfluXROcpxgAdGkPqG4Kh9CfL3kxj178osq60oGBchtF4 b5pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=XHPjHzAx; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id m16-20020a63fd50000000b00588d84b1215si93821pgj.876.2023.10.11.09.29.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 09:29:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=XHPjHzAx; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 049748145942; Wed, 11 Oct 2023 09:29:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232919AbjJKQ3J (ORCPT + 99 others); Wed, 11 Oct 2023 12:29:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230271AbjJKQ3I (ORCPT ); Wed, 11 Oct 2023 12:29:08 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D93B91; Wed, 11 Oct 2023 09:29:06 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 553701FF02; Wed, 11 Oct 2023 16:29:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1697041745; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kYo77x54AzSd+UJL48y6CRA7yZ5+4RMlae1FSxp7kUY=; b=XHPjHzAxZGN8OAcbkRlJpzZcxSqh0PmgTt4npi1tF+csKiWIXSr22Q66FJM2N/QWXLTuWe 8qU5i1XbtqtXqXqGt/BP2COPochp4eKiQbidoNtY9W7y4PLwiWnw+G09P8eyOvIpOvA4z+ moXDGeLe/pOS1YzwKZ2VAtQlYMqPsxs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1697041745; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kYo77x54AzSd+UJL48y6CRA7yZ5+4RMlae1FSxp7kUY=; b=T1jExGE6EAUwcpMkNyi3OKySzAjG7myKC5zvA28x5gD6fljvVqNo3e5cwm9l9v5cfaJ+fM pqEjb6y8O4ZxlvDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 43D03134F5; Wed, 11 Oct 2023 16:29:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kvp+EFHNJmVlLQAAMHmgww (envelope-from ); Wed, 11 Oct 2023 16:29:05 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id C9ED1A05BC; Wed, 11 Oct 2023 18:29:04 +0200 (CEST) Date: Wed, 11 Oct 2023 18:29:04 +0200 From: Jan Kara To: Christian Brauner Cc: Jan Kara , Max Kellermann , Xiubo Li , Ilya Dryomov , Jeff Layton , Jan Kara , Dave Kleikamp , ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org, jfs-discussion@lists.sourceforge.net, Yang Xu , linux-fsdevel@vger.kernel.org, Amir Goldstein Subject: Re: [PATCH v2] fs/{posix_acl,ext2,jfs,ceph}: apply umask if ACL support is disabled Message-ID: <20231011162904.3dxkids7zzspcolp@quack3> References: <20231009144340.418904-1-max.kellermann@ionos.com> <20231010131125.3uyfkqbcetfcqsve@quack3> <20231011100541.sfn3prgtmp7hk2oj@quack3> <20231011120655.ndb7bfasptjym3wl@quack3> <20231011135922.4bij3ittlg4ujkd7@quack3> <20231011-braumeister-anrufen-62127dc64de0@brauner> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231011-braumeister-anrufen-62127dc64de0@brauner> X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 11 Oct 2023 09:29:36 -0700 (PDT) X-Spam-Level: ** On Wed 11-10-23 17:27:37, Christian Brauner wrote: > On Wed, Oct 11, 2023 at 03:59:22PM +0200, Jan Kara wrote: > > On Wed 11-10-23 14:27:49, Max Kellermann wrote: > > > On Wed, Oct 11, 2023 at 2:18 PM Max Kellermann wrote: > > > > But without the other filesystems. I'll resend it with just the > > > > posix_acl.h hunk. > > > > > > Thinking again, I don't think this is the proper solution. This may > > > server as a workaround so those broken filesystems don't suffer from > > > this bug, but it's not proper. > > > > > > posix_acl_create() is only supposed to appy the umask if the inode > > > supports ACLs; if not, the VFS is supposed to do it. But if the > > > filesystem pretends to have ACL support but the kernel does not, it's > > > really a filesystem bug. Hacking the umask code into > > > posix_acl_create() for that inconsistent case doesn't sound right. > > > > > > A better workaround would be this patch: > > > https://patchwork.kernel.org/project/linux-nfs/patch/151603744662.29035.4910161264124875658.stgit@rabbit.intern.cm-ag/ > > > I submitted it more than 5 years ago, it got one positive review, but > > > was never merged. > > > > > > This patch enables the VFS's umask code even if the filesystem > > > prerents to support ACLs. This still doesn't fix the filesystem bug, > > > but makes VFS's behavior consistent. > > > > OK, that solution works for me as well. I agree it seems a tad bit cleaner. > > Christian, which one would you prefer? > > So it always bugged me that POSIX ACLs push umask stripping down into > the individual filesystems but it's hard to get rid of this. And we > tried to improve the situation during the POSIX ACL rework by > introducing vfs_prepare_umask(). > > Aside from that, the problem had been that filesystems like nfs v4 > intentionally raised SB_POSIXACL to prevent umask stripping in the VFS. > IOW, for them SB_POSIXACL was equivalent to "don't apply any umask". Ah, what a hack... > And afaict nfs v4 has it's own thing going on how and where umasks are > applied. However, since we now have the following commit in vfs.misc: > > commit f61b9bb3f8386a5e59b49bf1310f5b34f47bcef9 > Author: Jeff Layton > AuthorDate: Mon Sep 11 20:25:50 2023 -0400 > Commit: Christian Brauner > CommitDate: Thu Sep 21 15:37:47 2023 +0200 > > fs: add a new SB_I_NOUMASK flag > > SB_POSIXACL must be set when a filesystem supports POSIX ACLs, but NFSv4 > also sets this flag to prevent the VFS from applying the umask on > newly-created files. NFSv4 doesn't support POSIX ACLs however, which > causes confusion when other subsystems try to test for them. > > Add a new SB_I_NOUMASK flag that allows filesystems to opt-in to umask > stripping without advertising support for POSIX ACLs. Set the new flag > on NFSv4 instead of SB_POSIXACL. > > Also, move mode_strip_umask to namei.h and convert init_mknod and > init_mkdir to use it. > > Signed-off-by: Jeff Layton > Message-Id: <20230911-acl-fix-v3-1-b25315333f6c@kernel.org> > Signed-off-by: Christian Brauner > > I think it's possible to pick up the first patch linked above: > > fix umask on NFS with CONFIG_FS_POSIX_ACL=n doesn't lead to any > > and see whether we see any regressions from this. > > The second patch I can't easily judge that should go through nfs if at > all. > > So proposal/question: should we take the first patch into vfs.misc? Sounds good to me. I have checked whether some other filesystem does not try to play similar games as NFS and it appears not although overlayfs does seem to play some games with umasks. Honza -- Jan Kara SUSE Labs, CR