Skip to contentSkip to conversation

SLIM LSM getprocattr hook API change

PATCH New Mimi Zohar 1 participant 1 message Mar 23, 2007 Security (LSM)

lore
Share & tools
lore

Mimi Zohar

author
#0 lore raw

PATCH 1/1 SLIM LSM getprocattr hook API change

This patch addresses the 2.6.21-rc4 LSM getprocattr hook API change.

---

security/slim/slm_main.c +9 -5
Index: linux-2.6.21-rc4-mm1/security/slim/slm_main.c
===================================================================
@@ -1269,25 +1269,29 @@ static int slm_setprocattr(struct task_s
 }
 
 static int slm_getprocattr(struct task_struct *tsk,
-				  char *name, void *value, size_t size)
+				  char *name, char **value)
 {
 	struct slm_tsec_data *tsec = tsk->security;
 	size_t len = 0;
+	int buf_size = 31;
+	char buf[buf_size];
 
 	if (is_kernel_thread(tsk))
-		len = snprintf(value, size, "KERNEL");
+		len = snprintf(buf, buf_size, "KERNEL");
 	else {
 		spin_lock(&tsec->lock);
 		if (tsec->iac_wx != tsec->iac_r)
-			len = snprintf(value, size, "GUARD wx:%s r:%s",
+			len = snprintf(buf, buf_size, "GUARD wx:%s r:%s",
 				       slm_iac_str[tsec->iac_wx],
 				       slm_iac_str[tsec->iac_r]);
 		else
-			len = snprintf(value, size, "%s",
+			len = snprintf(buf, buf_size, "%s",
 				       slm_iac_str[tsec->iac_wx]);
 		spin_unlock(&tsec->lock);
 	}
-	return min(len, size);
+	*value = kzalloc(len, GFP_KERNEL);
+	memcpy(*value, buf, len);
+	return len;
 }
 
 /*