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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 21 Oct 2007 03:40:21 +0200
From:	"Ahmed S. Darwish" <darwish.07@...il.com>
To:	Casey Schaufler <casey@...aufler-ca.com>
Cc:	torvalds@...l.org, akpm@...l.org,
	linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] Smackv8: Omit non-cipso labels in cipso_seq_start

Hi!,

[Casey, sending patches in public to get an early review]

Omit non-cipso labels in cipso_seq_start().

Signed-off-by: Ahmed S. Darwish <darwish.07@...il.com>
---
stopping seq_show() if smk_cipso = NULL only fixes the bug 
symptom. We'll issue a BUG() in that case cause it signals a
serious misbehavior in the list entries.

diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 55ba2dc..b061cd0 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -297,14 +297,22 @@ void smk_cipso_doi(void)
 
 /*
  * Seq_file read operations for /smack/cipso
+ *
+ * Omit labels with no associated cipso values from being
+ * displayed in seq_show()
  */
 
 static void *cipso_seq_start(struct seq_file *s, loff_t *pos)
 {
+	struct smack_known *skp = smack_known;
+
 	if (*pos >= smack_cipso_count)
 		return NULL;
 
-	return smack_known;
+	while (skp && !skp->smk_cipso)
+		skp = skp->smk_next;
+
+	return skp;
 }
 
 static void *cipso_seq_next(struct seq_file *s, void *v, loff_t *pos)
@@ -313,9 +321,6 @@ static void *cipso_seq_next(struct seq_file *s, void *v, loff_t *pos)
 
 	(*pos)++;
 
-	/*
-	 * Omit labels with no associated cipso value
-	 */
 	while (skp && !skp->smk_cipso)
 		skp = skp->smk_next;
 
@@ -336,12 +341,11 @@ static int cipso_seq_show(struct seq_file *s, void *v)
 	int i;
 	unsigned char m;
 
-	if (scp == NULL)
-		return 0;
+	BUG_ON(!scp);
+	cbp = scp->smk_catset;
 
 	seq_printf(s, "%s %3d", (char *)&skp->smk_known, scp->smk_level);
 
-	cbp = scp->smk_catset;
 	for (i = 0; i < SMK_LABELLEN; i++)
 		for (m = 0x80; m != 0; m >>= 1) {
 			if (m & cbp[i]) {


-- 
Ahmed S. Darwish
HomePage: http://darwish.07.googlepages.com
Blog: http://darwish-07.blogspot.com
-
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