Skip to content

Commit 2bc5e5e

Browse files
committed
ovl: rely on SB_I_NOUMASK
In commit f61b9bb ("fs: add a new SB_I_NOUMASK flag") we added a new SB_I_NOUMASK flag that is used by filesystems like NFS to indicate that umask stripping is never supposed to be done in the vfs independent of whether or not POSIX ACLs are supported. Overlayfs falls into the same category as it raises SB_POSIXACL unconditionally to defer umask application to the upper filesystem. Now that we have SB_I_NOUMASK use that and make SB_POSIXACL properly conditional on whether or not the kernel does have support for it. This will enable use to turn IS_POSIXACL() into nop on kernels that don't have POSIX ACL support avoding bugs from missed umask stripping. Link: https://lore.kernel.org/r/20231012-einband-uferpromenade-80541a047a1f@brauner Acked-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent e4e8b47 commit 2bc5e5e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

fs/overlayfs/super.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,8 +1489,16 @@ int ovl_fill_super(struct super_block *sb, struct fs_context *fc)
14891489
sb->s_xattr = ofs->config.userxattr ? ovl_user_xattr_handlers :
14901490
ovl_trusted_xattr_handlers;
14911491
sb->s_fs_info = ofs;
1492+
#ifdef CONFIG_FS_POSIX_ACL
14921493
sb->s_flags |= SB_POSIXACL;
1494+
#endif
14931495
sb->s_iflags |= SB_I_SKIP_SYNC | SB_I_IMA_UNVERIFIABLE_SIGNATURE;
1496+
/*
1497+
* Ensure that umask handling is done by the filesystems used
1498+
* for the the upper layer instead of overlayfs as that would
1499+
* lead to unexpected results.
1500+
*/
1501+
sb->s_iflags |= SB_I_NOUMASK;
14941502

14951503
err = -ENOMEM;
14961504
root_dentry = ovl_get_root(sb, ctx->upper.dentry, oe);

0 commit comments

Comments
 (0)