Skip to contentSkip to conversation

cr: allocate security context for msg_msg

PATCH Applied Serge E. Hallyn 2 participants 2 messages Jun 30, 2009 – Jul 2, 2009 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cr: allocate security context for msg_msg

Since we create msg_msg structs by hand, we also need to ask LSM to allocate a security context. Otherwise selinux_msg_queue_msgrcv will throw a fit dereferencing msg->security (6b6b6b6b6b6b6000).

With this patch, cr tests can be executed with selinux enabled.

---
 ipc/checkpoint_msg.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
ipc/checkpoint_msg.c +3 -0
index 51385b0..fca8e7d 100644
@@ -17,6 +17,7 @@
 #include <linux/sched.h>
 #include <linux/syscalls.h>
 #include <linux/nsproxy.h>
+#include <linux/security.h>
 #include <linux/ipc_namespace.h>
 
 #include "util.h"
@@ -248,6 +249,8 @@ static struct msg_msg *restore_msg_contents_one(struct ckpt_ctx *ctx, int *clen)
 	msg->m_type = h->m_type;
 	msg->m_ts = h->m_ts;
 	*clen = h->m_ts;
+	ret = security_msg_msg_alloc(msg);
+
  out:
 	if (ret < 0 && msg) {
 		free_msg(msg);
Signature · 1 line
1.6.1

A message that is not in the archive (sent off-list or not yet received): 20090630201950.GA22761-r/[email protected]

Applied
#2 lore raw

Applied to v17.

Oren.

Quoted 34 lines · Serge E. Hallyn

Since we create msg_msg structs by hand, we also need to ask LSM to allocate a security context. Otherwise selinux_msg_queue_msgrcv will throw a fit dereferencing msg->security (6b6b6b6b6b6b6000).

With this patch, cr tests can be executed with selinux enabled.

---
 ipc/checkpoint_msg.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
ipc/checkpoint_msg.c +3 -0
index 51385b0..fca8e7d 100644
@@ -17,6 +17,7 @@
 #include <linux/sched.h>
 #include <linux/syscalls.h>
 #include <linux/nsproxy.h>
+#include <linux/security.h>
 #include <linux/ipc_namespace.h>
 
 #include "util.h"
@@ -248,6 +249,8 @@ static struct msg_msg *restore_msg_contents_one(struct ckpt_ctx *ctx, int *clen)
 	msg->m_type = h->m_type;
 	msg->m_ts = h->m_ts;
 	*clen = h->m_ts;
+	ret = security_msg_msg_alloc(msg);
+
  out:
 	if (ret < 0 && msg) {
 		free_msg(msg);