All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux-cr urgent] lsm: fix unlabeled restore case.
@ 2010-03-12 20:47 Serge E. Hallyn
       [not found] ` <20100312204706.GA408-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Serge E. Hallyn @ 2010-03-12 20:47 UTC (permalink / raw)
  To: Oren Laadan; +Cc: Linux Containers

If an object is being restored which was checkpointed without an
LSM label, then we should return 0 BEFORE we try to ckpt_obj_fetch
a -1 objref (and obviously return error).

This makes the msg cr_tests ipc testcase fail if, for instance,
CONFIG_SECURITY=y but no LSM is active.

IMO this definately should be in the tree that gets sent out...

Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 security/security.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/security/security.c b/security/security.c
index 2b147cf..4b3f932 100644
--- a/security/security.c
+++ b/security/security.c
@@ -1528,14 +1528,14 @@ int security_restore_obj(struct ckpt_ctx *ctx, void *v, int sectype,
 		if (sectype != CKPT_SECURITY_MSG_MSG)
 			return 0;
 
-	l = ckpt_obj_fetch(ctx, secref, CKPT_OBJ_SECURITY);
-	if (IS_ERR(l))
-		return PTR_ERR(l);
-
 	/* return if checkpointed label was "Not Applicable" */
 	if (secref == SECURITY_CTX_NONE)
 		return 0;
 
+	l = ckpt_obj_fetch(ctx, secref, CKPT_OBJ_SECURITY);
+	if (IS_ERR(l))
+		return PTR_ERR(l);
+
 	/* Ask the LSM to apply a void*security to the object
 	 * based on the checkpointed context string */
 	switch (sectype) {
-- 
1.6.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH linux-cr urgent] lsm: fix unlabeled restore case.
       [not found] ` <20100312204706.GA408-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2010-03-15  2:50   ` Oren Laadan
  0 siblings, 0 replies; 2+ messages in thread
From: Oren Laadan @ 2010-03-15  2:50 UTC (permalink / raw)
  To: Serge E. Hallyn; +Cc: Linux Containers


This is already in v20-rc1.

Oren

Serge E. Hallyn wrote:
> If an object is being restored which was checkpointed without an
> LSM label, then we should return 0 BEFORE we try to ckpt_obj_fetch
> a -1 objref (and obviously return error).
> 
> This makes the msg cr_tests ipc testcase fail if, for instance,
> CONFIG_SECURITY=y but no LSM is active.
> 
> IMO this definately should be in the tree that gets sent out...
> 
> Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> ---
>  security/security.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/security/security.c b/security/security.c
> index 2b147cf..4b3f932 100644
> --- a/security/security.c
> +++ b/security/security.c
> @@ -1528,14 +1528,14 @@ int security_restore_obj(struct ckpt_ctx *ctx, void *v, int sectype,
>  		if (sectype != CKPT_SECURITY_MSG_MSG)
>  			return 0;
>  
> -	l = ckpt_obj_fetch(ctx, secref, CKPT_OBJ_SECURITY);
> -	if (IS_ERR(l))
> -		return PTR_ERR(l);
> -
>  	/* return if checkpointed label was "Not Applicable" */
>  	if (secref == SECURITY_CTX_NONE)
>  		return 0;
>  
> +	l = ckpt_obj_fetch(ctx, secref, CKPT_OBJ_SECURITY);
> +	if (IS_ERR(l))
> +		return PTR_ERR(l);
> +
>  	/* Ask the LSM to apply a void*security to the object
>  	 * based on the checkpointed context string */
>  	switch (sectype) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-03-15  2:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-12 20:47 [PATCH linux-cr urgent] lsm: fix unlabeled restore case Serge E. Hallyn
     [not found] ` <20100312204706.GA408-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-03-15  2:50   ` Oren Laadan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.