lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 07 Sep 2023 13:32:36 -0400
From:   Jeff Layton <jlayton@...nel.org>
To:     Trond Myklebust <trond.myklebust@...merspace.com>,
        Anna Schumaker <anna@...nel.org>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        Christian Brauner <brauner@...nel.org>
Cc:     linux-nfs@...r.kernel.org, linux-kernel@...r.kernel.org,
        Ondrej Valousek <ondrej.valousek.xm@...esas.com>,
        Jeff Layton <jlayton@...nel.org>
Subject: [PATCH RFC] nfs4: add a get_acl stub handler

In older kernels, attempting to fetch that system.posix_acl_access on
NFSv4 would return -EOPNOTSUPP, but in more recent kernels that returns
-ENODATA.

Most filesystems that don't support POSIX ACLs leave the SB_POSIXACL
flag clear, which cues the VFS to return -EOPNOTSUPP in this situation.
We can't do that with NFSv4 since that flag also cues the VFS to avoid
applying the umask early.

Fix this by adding a stub get_acl handler for NFSv4 that always returns
-EOPNOTSUPP.

Reported-by: Ondrej Valousek <ondrej.valousek.xm@...esas.com>
Signed-off-by: Jeff Layton <jlayton@...nel.org>
---
I suspect that this problem popped in due to some VFS layer changes. I
haven't identified the patch that broke it, but I think this is probably
the least invasive way to fix it.

Another alternative would be to return -EOPNOTSUPP on filesystems that
set SB_POSIXACL but that don't set get_acl or get_inode_acl.

Thoughts?
---
 fs/nfs/nfs4proc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 794343790ea8..93f3caf4ec08 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -10621,6 +10621,12 @@ static void nfs4_disable_swap(struct inode *inode)
 	nfs4_schedule_state_manager(clp);
 }
 
+static struct posix_acl *nfs4_get_posix_acl(struct mnt_idmap *idmap, struct dentry *dentry,
+					    int type)
+{
+	return ERR_PTR(-EOPNOTSUPP);
+}
+
 static const struct inode_operations nfs4_dir_inode_operations = {
 	.create		= nfs_create,
 	.lookup		= nfs_lookup,
@@ -10636,6 +10642,7 @@ static const struct inode_operations nfs4_dir_inode_operations = {
 	.getattr	= nfs_getattr,
 	.setattr	= nfs_setattr,
 	.listxattr	= nfs4_listxattr,
+	.get_acl	= nfs4_get_posix_acl,
 };
 
 static const struct inode_operations nfs4_file_inode_operations = {
@@ -10643,6 +10650,7 @@ static const struct inode_operations nfs4_file_inode_operations = {
 	.getattr	= nfs_getattr,
 	.setattr	= nfs_setattr,
 	.listxattr	= nfs4_listxattr,
+	.get_acl	= nfs4_get_posix_acl,
 };
 
 const struct nfs_rpc_ops nfs_v4_clientops = {

---
base-commit: c0894ef10b846fd4a74a670cbec2483246030e06
change-id: 20230907-kdevops-d311e57bf5d2

Best regards,
-- 
Jeff Layton <jlayton@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ