Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.bugs.dist > #1014067
| From | Salvatore Bonaccorso <carnil@debian.org> |
|---|---|
| Newsgroups | linux.debian.bugs.dist, linux.debian.kernel |
| Subject | Bug#962254: Umask ignored when mounting NFSv4.2 share of an exported Filesystem with noacl (was: Re: Bug#962254: NFS(v4) broken at 4.19.118-2) |
| Date | 2020-06-16 07:40 +0200 |
| Message-ID | <Aicud-v9-5@gated-at.bofh.it> (permalink) |
| References | (7 earlier) <AhYUi-Kt-9@gated-at.bofh.it> <Ai2uS-2IP-9@gated-at.bofh.it> <Ai9PH-7gF-3@gated-at.bofh.it> <AedoR-7Uq-1@gated-at.bofh.it> <Ai9PH-7gF-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Cross-posted to 2 groups.
Hi Bruce,
On Mon, Jun 15, 2020 at 10:38:20PM -0400, J. Bruce Fields wrote:
> Thanks for the detailed reproducer.
>
> It's weird, as the server is basically just setting the transmitted
> umask and then calling into the vfs to handle the rest, so it's not much
> different from any other user. But the same reproducer run just on the
> ext4 filesystem does give the right permissions....
>
> Oh, but looking at the system call, fs_namei.c:do_mkdirat(), it does:
>
> if (!IS_POSIXACL(path.dentry->d_inode))
> mode &= ~current_umask();
> error = security_path_mkdir(&path, dentry, mode);
> if (!error)
> error = vfs_mkdir(path.dentry->d_inode, dentry, mode);
>
> whereas nfsd just calls into vfs_mkdir().
>
> And that IS_POSIXACL() check is exactly a check whether the filesystem
> supports ACLs. So I guess it's the responsibility of the caller of
> vfs_mkdir() to handle that case.
>
> So the obvious fix is something like (untested!)
>
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index 0aa02eb18bd3..dabdcca58969 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -1234,6 +1234,8 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp,
> nfsd_check_ignore_resizing(iap);
> break;
> case S_IFDIR:
> + if (!IS_POSIXACL(dirp))
> + iap->ia_mode &= ~current_umask();
> host_err = vfs_mkdir(dirp, dchild, iap->ia_mode);
> if (!host_err && unlikely(d_unhashed(dchild))) {
> struct dentry *d;
Thank you!
Tested your patch on top, and it would solve the directory case, but
the underlying problem is more general (and as you said proably needs
further checking in other places):
root@nfs-test:~# mount -t nfs 192.168.122.150:/srv/data /mnt
root@nfs-test:~# mkdir /mnt/foo && ls -ld /mnt/foo && rmdir /mnt/foo
drwxr-xr-x 2 root root 4096 Jun 16 07:24 /mnt/foo
root@nfs-test:~# touch /mnt/foo && ls -ld /mnt/foo && rm /mnt/foo
-rw-rw-rw- 1 root root 0 Jun 16 07:25 /mnt/foo
root@nfs-test:~# umount /mnt
root@nfs-test:~#
So when creating files the umask is still ignored in the noacl mounted
case.
Regards,
Salvatore
Back to linux.debian.bugs.dist | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Bug#962254: NFS(v4) broken at 4.19.118-2 Elliott Mitchell <ehem+debian@m5p.com> - 2020-06-05 07:50 +0200
Bug#962254: NFS(v4) broken at 4.19.118-2 Salvatore Bonaccorso <carnil@debian.org> - 2020-06-05 08:50 +0200
Bug#962254: NFS(v4) broken at 4.19.118-2 Elliott Mitchell <ehem+debian@m5p.com> - 2020-06-05 20:20 +0200
Bug#962254: NFS(v4) broken at 4.19.118-2 Salvatore Bonaccorso <carnil@debian.org> - 2020-06-05 20:40 +0200
Bug#962254: NFS(v4) broken at 4.19.118-2 Elliott Mitchell <ehem+debian@m5p.com> - 2020-06-06 00:40 +0200
Bug#934160: Bug#962254: NFS(v4) broken at 4.19.118-2 Elliott Mitchell <ehem+debian@m5p.com> - 2020-06-09 04:00 +0200
Bug#962254: Umask ignored when mounting NFSv4.2 share of an exported ZFS (with acltype=off) (was: Re: Bug#962254: NFS(v4) broken at 4.19.118-2) Salvatore Bonaccorso <carnil@debian.org> - 2020-06-13 15:00 +0200
Bug#962254: Umask ignored when mounting NFSv4.2 share of an exported ZFS (with acltype=off) (was: Re: Bug#962254: NFS(v4) broken at 4.19.118-2) "J. Bruce Fields" <bfields@redhat.com> - 2020-06-15 17:10 +0200
Bug#962254: Umask ignored when mounting NFSv4.2 share of an exported Filesystem with noacl (was: Re: Bug#962254: NFS(v4) broken at 4.19.118-2) Salvatore Bonaccorso <carnil@debian.org> - 2020-06-15 21:00 +0200
Bug#962254: Umask ignored when mounting NFSv4.2 share of an exported Filesystem with noacl (was: Re: Bug#962254: NFS(v4) broken at 4.19.118-2) "J. Bruce Fields" <bfields@redhat.com> - 2020-06-16 04:50 +0200
Bug#962254: Umask ignored when mounting NFSv4.2 share of an exported Filesystem with noacl (was: Re: Bug#962254: NFS(v4) broken at 4.19.118-2) Salvatore Bonaccorso <carnil@debian.org> - 2020-06-16 07:40 +0200
Bug#962254: Umask ignored when mounting NFSv4.2 share of an exported Filesystem with noacl (was: Re: Bug#962254: NFS(v4) broken at 4.19.118-2) Salvatore Bonaccorso <carnil@debian.org> - 2020-06-16 18:30 +0200
Bug#962254: Umask ignored when mounting NFSv4.2 share of an exported Filesystem with noacl (was: Re: Bug#962254: NFS(v4) broken at 4.19.118-2) "J. Bruce Fields" <bfields@redhat.com> - 2020-06-17 03:10 +0200
Bug#962254: Umask ignored when mounting NFSv4.2 share of an exported Filesystem with noacl Salvatore Bonaccorso <carnil@debian.org> - 2020-06-17 07:10 +0200
Bug#962254: Umask ignored when mounting NFSv4.2 share of an exported Filesystem with noacl (was: Re: Bug#962254: NFS(v4) broken at 4.19.118-2) Salvatore Bonaccorso <carnil@debian.org> - 2020-06-16 07:40 +0200
Bug#962254: Umask ignored when mounting NFSv4.2 share of an exported Filesystem with noacl (was: Re: Bug#962254: NFS(v4) broken at 4.19.118-2) "J. Bruce Fields" <bfields@redhat.com> - 2020-06-17 17:40 +0200
Bug#962254: Umask ignored when mounting NFSv4.2 share of an exported Filesystem with noacl (was: Re: Bug#962254: NFS(v4) broken at 4.19.118-2) Andreas Gruenbacher <agruenba@redhat.com> - 2020-06-17 19:00 +0200
csiph-web