From: Jan Kara <jack@suse.cz>
To: Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>,
Max Kellermann <max.kellermann@ionos.com>,
Xiubo Li <xiubli@redhat.com>, Ilya Dryomov <idryomov@gmail.com>,
Jeff Layton <jlayton@kernel.org>, Jan Kara <jack@suse.com>,
Dave Kleikamp <shaggy@kernel.org>,
ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-ext4@vger.kernel.org, jfs-discussion@lists.sourceforge.net,
Yang Xu <xuyang2018.jy@fujitsu.com>,
linux-fsdevel@vger.kernel.org,
Amir Goldstein <amir73il@gmail.com>
Subject: Re: [PATCH v2] fs/{posix_acl,ext2,jfs,ceph}: apply umask if ACL support is disabled
Date: Wed, 11 Oct 2023 18:29:04 +0200 [thread overview]
Message-ID: <20231011162904.3dxkids7zzspcolp@quack3> (raw)
In-Reply-To: <20231011-braumeister-anrufen-62127dc64de0@brauner>
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 <max.kellermann@ionos.com> 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 <jlayton@kernel.org>
> AuthorDate: Mon Sep 11 20:25:50 2023 -0400
> Commit: Christian Brauner <brauner@kernel.org>
> 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 <jlayton@kernel.org>
> Message-Id: <20230911-acl-fix-v3-1-b25315333f6c@kernel.org>
> Signed-off-by: Christian Brauner <brauner@kernel.org>
>
> 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 <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2023-10-11 16:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <69dda7be-d7c8-401f-89f3-7a5ca5550e2f@oracle.com>
[not found] ` <20231009144340.418904-1-max.kellermann@ionos.com>
[not found] ` <20231010131125.3uyfkqbcetfcqsve@quack3>
[not found] ` <CAKPOu+-nC2bQTZYL0XTzJL6Tx4Pi1gLfNWCjU2Qz1f_5CbJc1w@mail.gmail.com>
[not found] ` <20231011100541.sfn3prgtmp7hk2oj@quack3>
[not found] ` <CAKPOu+_xdFALt9sgdd5w66Ab6KTqiy8+Z0Yd3Ss4+92jh8nCwg@mail.gmail.com>
2023-10-11 12:06 ` [PATCH v2] fs/{posix_acl,ext2,jfs,ceph}: apply umask if ACL support is disabled Jan Kara
2023-10-11 12:18 ` Max Kellermann
2023-10-11 12:27 ` Jan Kara
2023-10-11 12:27 ` Max Kellermann
2023-10-11 13:59 ` Jan Kara
2023-10-11 15:27 ` Christian Brauner
2023-10-11 16:29 ` Jan Kara [this message]
2023-10-12 9:22 ` Christian Brauner
2023-10-12 9:41 ` Jan Kara
2023-10-11 17:00 ` Theodore Ts'o
2023-10-11 17:26 ` Jan Kara
2023-10-12 14:29 ` Theodore Ts'o
2023-10-12 14:42 ` Jan Kara
2024-03-13 20:40 ` Michael Forney
2024-03-14 13:08 ` Max Kellermann
2024-03-15 13:52 ` Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231011162904.3dxkids7zzspcolp@quack3 \
--to=jack@suse.cz \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=jack@suse.com \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=jlayton@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=max.kellermann@ionos.com \
--cc=shaggy@kernel.org \
--cc=xiubli@redhat.com \
--cc=xuyang2018.jy@fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).