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]
Message-ID: <49E4D5B6.80202@numericable.fr>
Date:	Tue, 14 Apr 2009 20:28:06 +0200
From:	Etienne Basset <etienne.basset@...ericable.fr>
To:	Casey Schaufler <casey@...aufler-ca.com>,
	LSM <linux-security-module@...r.kernel.org>
CC:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [PATCH] Smack: check for SMACK xattr max size in  smack_inode_setxattr

the following patch move the check for SMACK xattr size >= SMK_LABELLEN
from  smack_inode_post_setxattr (which cannot return an error to the user)
to smack_inode_setxattr (which can return an error).

without patch a SMACK setxattr with size >= SMK_LABELLEN returns success although it doesn't 

Signed-off-by: Etienne Basset <etienne.basset@...ericable.fr>
---
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 9215149..da6954d 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -610,7 +610,8 @@ static int smack_inode_setxattr(struct dentry *dentry, const char *name,
 		if (!capable(CAP_MAC_ADMIN))
 			rc = -EPERM;
 		/* a label cannot be void and cannot begin with '-' */
-		if (size == 0 || (size > 0 && ((char *)value)[0] == '-'))
+		if (size == 0 || size >= SMK_LABELLEN ||
+		   (size > 0 && ((char *)value)[0] == '-'))
 			rc = -EINVAL;
 	} else
 		rc = cap_inode_setxattr(dentry, name, value, size, flags);
@@ -644,9 +645,6 @@ static void smack_inode_post_setxattr(struct dentry *dentry, const char *name,
 	if (strcmp(name, XATTR_NAME_SMACK))
 		return;
 
-	if (size >= SMK_LABELLEN)
-		return;
-
 	isp = dentry->d_inode->i_security;
 
 	/*

--
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