[Patch -mm 1/1] SLIM LSM getprocattr hook API change

From: Mimi Zohar
Date: Fri Mar 23 2007 - 12:54:21 EST


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

signed-off-by: Mimi Zohar <zohar@xxxxxxxxxx>
---
Index: linux-2.6.21-rc4-mm1/security/slim/slm_main.c
===================================================================
--- linux-2.6.21-rc4-mm1.orig/security/slim/slm_main.c
+++ 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;
}

/*



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