Skip to contentSkip to conversation

always restore msg_msg label

PATCH In review Serge E. Hallyn 2 participants 2 messages Mar 9, 2010 – Mar 15, 2010 1 message not in the archive Security (LSM)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 always restore msg_msg label

Hi Oren,

In comparing your ckpt-v19-dev-serge branch to my local one I noticed this patch was missing, then realized I hadn't sent it separately, but only inline with a response to Nathan.

Please do apply.

Without this patch, selinux labels will not be restored on msg_msg's in message queues (because we didn't send the restored msg_msg through msgsnd), and the restored task won't have the permission to receive the messages.

As I mentioned in that thread, simply re-routing the restored msg_msg through msgsnd doesn't really suffice because the msg_msg label is calculated as a product of the msgq and sending task labels, and the latter may have already changed.

thanks,
-serge

---
 security/security.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
security/security.c +3 -1
index 28db976..2b147cf 100644
@@ -1524,7 +1524,9 @@ int security_restore_obj(struct ckpt_ctx *ctx, void *v, int sectype,
 
 	/* return if caller didn't want to restore checkpointed labels */
 	if (!(ctx->uflags & RESTART_KEEP_LSM))
-		return 0;
+		/* though msg_msg label must always be restored */
+		if (sectype != CKPT_SECURITY_MSG_MSG)
+			return 0;
 
 	l = ckpt_obj_fetch(ctx, secref, CKPT_OBJ_SECURITY);
 	if (IS_ERR(l))
Signature · 1 line
1.6.0.6

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

#2 lore raw

In v20-rc1.

Quoted 41 lines · Serge E. Hallyn

Hi Oren,

In comparing your ckpt-v19-dev-serge branch to my local one I noticed this patch was missing, then realized I hadn't sent it separately, but only inline with a response to Nathan.

Please do apply.

Without this patch, selinux labels will not be restored on msg_msg's in message queues (because we didn't send the restored msg_msg through msgsnd), and the restored task won't have the permission to receive the messages.

As I mentioned in that thread, simply re-routing the restored msg_msg through msgsnd doesn't really suffice because the msg_msg label is calculated as a product of the msgq and sending task labels, and the latter may have already changed.

thanks,
-serge

---
 security/security.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
security/security.c +3 -1
index 28db976..2b147cf 100644
@@ -1524,7 +1524,9 @@ int security_restore_obj(struct ckpt_ctx *ctx, void *v, int sectype,
 
 	/* return if caller didn't want to restore checkpointed labels */
 	if (!(ctx->uflags & RESTART_KEEP_LSM))
-		return 0;
+		/* though msg_msg label must always be restored */
+		if (sectype != CKPT_SECURITY_MSG_MSG)
+			return 0;
 
 	l = ckpt_obj_fetch(ctx, secref, CKPT_OBJ_SECURITY);
 	if (IS_ERR(l))