Re: [PATCH v2] fs: add a new SB_NOUMASK flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Sep 10, 2023 at 03:30:48PM -0400, Jeff Layton wrote:
> 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.
> 
> Split the umask-stripping opt-out into a separate SB_NOUMASK flag, and
> have NFSv4 set that instead of SB_POSIXACL. Fix the appropriate places
> in the VFS to check for that flag (in addition to SB_POSIXACL) when
> stripping the umask.

Oh, I see you only raised SB_POSIXACL to avoid umask stripping. That's a
bit weird indeed. Hm, since this is an internal, non-user changeable
flag I think it might be better in s_iflags as SB_I_NOUMASK? Also allows
us to avoid wasting an s_flags bit.

> 
> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
> ---
> Yet another approach to fixing this issue. I think this way is probably
> the best, since makes the purpose of these flags clearer, and stops NFS
> from relying on SB_POSIXACL to avoid umask stripping.
> ---
> Changes in v2:
> - new approach: add a new SB_NOUMASK flag that NFSv4 can use instead of
>   SB_POSIXACL
> - Link to v1: https://lore.kernel.org/r/20230908-acl-fix-v1-1-1e6b76c8dcc8@xxxxxxxxxx
> ---
>  fs/init.c          | 4 ++--
>  fs/namei.c         | 2 +-
>  fs/nfs/super.c     | 2 +-
>  include/linux/fs.h | 4 +++-
>  4 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/init.c b/fs/init.c
> index 9684406a8416..157404bb7d19 100644
> --- a/fs/init.c
> +++ b/fs/init.c
> @@ -153,7 +153,7 @@ int __init init_mknod(const char *filename, umode_t mode, unsigned int dev)
>  	if (IS_ERR(dentry))
>  		return PTR_ERR(dentry);
>  
> -	if (!IS_POSIXACL(path.dentry->d_inode))
> +	if (!IS_NOUMASK(path.dentry->d_inode))
>  		mode &= ~current_umask();
>  	error = security_path_mknod(&path, dentry, mode, dev);
>  	if (!error)
> @@ -229,7 +229,7 @@ int __init init_mkdir(const char *pathname, umode_t mode)
>  	dentry = kern_path_create(AT_FDCWD, pathname, &path, LOOKUP_DIRECTORY);
>  	if (IS_ERR(dentry))
>  		return PTR_ERR(dentry);
> -	if (!IS_POSIXACL(path.dentry->d_inode))
> +	if (!IS_NOUMASK(path.dentry->d_inode))
>  		mode &= ~current_umask();

Could you please just convert them over to mode_strip_umask()?
Seems I forgot these two places back then.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux