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>] [day] [month] [year] [list]
Date:	Mon, 20 Aug 2007 16:53:28 -0400
From:	Jeff Layton <jlayton@...hat.com>
To:	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Cc:	linux-cifs-client@...ts.samba.org, nfs@...ts.sourceforge.net
Subject: [PATCH 3/4] Fix networked filesystems to handle ATTR_KILL_ bits correctly

This fixes NFS and CIFS to take advantage of the new scheme for
handling setuid/setgid bits. For these filesystems we want to just
let the server handle clearing these bits since the client may not
have permissions to do so.

For CIFS, this adds a patch to clear the ATTR_KILL bits so that
notify_change doesn't try to do a second setattr. NFS already clears
these bits, and this just updates a comment to make it clear
that doing this is more than an optimization.

Signed-off-by: Jeff Layton <jlayton@...hat.com>
---
 fs/cifs/inode.c |    5 +++++
 fs/nfs/inode.c  |    6 +++++-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index dd41677..9668b45 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1429,6 +1429,11 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
 	cifs_sb = CIFS_SB(direntry->d_inode->i_sb);
 	pTcon = cifs_sb->tcon;
 
+	/* We may not have permissions to clear the setuid/setgid flags. So
+	 * ignore them and let the server handle it.
+	 */
+	attrs->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID);
+
 	if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) == 0) {
 		/* check if we have permission to change attrs */
 		rc = inode_change_ok(direntry->d_inode, attrs);
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 93fc788..b257f18 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -332,7 +332,11 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
 			attr->ia_valid &= ~ATTR_SIZE;
 	}
 
-	/* Optimization: if the end result is no change, don't RPC */
+	/*
+	 * Optimization: if the end result is no change, don't RPC. This
+	 * also clears the ATTR_KILL_* flags, which is now needed by
+	 * notify_change.
+	 */
 	attr->ia_valid &= NFS_VALID_ATTRS;
 	if (attr->ia_valid == 0)
 		return 0;
-- 
1.5.2.2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ