All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selinux_xfrm_sec_ctx_alloc: null-terminate context string
@ 2007-07-24 14:53 Venkat Yekkirala
  2007-07-24 16:22 ` Joy Latten
  2007-07-24 19:20 ` Stephen Smalley
  0 siblings, 2 replies; 5+ messages in thread
From: Venkat Yekkirala @ 2007-07-24 14:53 UTC (permalink / raw)
  To: selinux; +Cc: jmorris, sds, latten

xfrm_audit_log() expects the context string to be null-terminated
which currently doesn't happen with user-supplied contexts.

Signed-off-by: Venkat Yekkirala <vyekkirala@TrustedCS.com>
---
 security/selinux/xfrm.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- selinux-2.6/security/selinux/xfrm.c	2007-07-24 09:43:23.000000000 -0500
+++ selinux-2.6/security/selinux/xfrm.c	2007-07-24 09:44:11.000000000 -0500
@@ -216,7 +216,7 @@ static int selinux_xfrm_sec_ctx_alloc(st
 		return -ENOMEM;
 
 	*ctxp = ctx = kmalloc(sizeof(*ctx) +
-			      uctx->ctx_len,
+			      uctx->ctx_len + 1,
 			      GFP_KERNEL);
 
 	if (!ctx)
@@ -229,6 +229,7 @@ static int selinux_xfrm_sec_ctx_alloc(st
 	memcpy(ctx->ctx_str,
 	       uctx+1,
 	       ctx->ctx_len);
+	ctx->ctx_str[ctx->ctx_len] = 0;
 	rc = security_context_to_sid(ctx->ctx_str,
 				     ctx->ctx_len,
 				     &ctx->ctx_sid);

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

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

* Re: [PATCH] selinux_xfrm_sec_ctx_alloc: null-terminate context string
  2007-07-24 14:53 [PATCH] selinux_xfrm_sec_ctx_alloc: null-terminate context string Venkat Yekkirala
@ 2007-07-24 16:22 ` Joy Latten
  2007-07-24 16:45   ` Joy Latten
  2007-07-24 19:20 ` Stephen Smalley
  1 sibling, 1 reply; 5+ messages in thread
From: Joy Latten @ 2007-07-24 16:22 UTC (permalink / raw)
  To: Venkat Yekkirala; +Cc: selinux, jmorris, sds

On Tue, 2007-07-24 at 09:53 -0500, Venkat Yekkirala wrote:
> xfrm_audit_log() expects the context string to be null-terminated
> which currently doesn't happen with user-supplied contexts.
> 
> Signed-off-by: Venkat Yekkirala <vyekkirala@TrustedCS.com>
> ---
>  security/selinux/xfrm.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> --- selinux-2.6/security/selinux/xfrm.c	2007-07-24 09:43:23.000000000 -0500
> +++ selinux-2.6/security/selinux/xfrm.c	2007-07-24 09:44:11.000000000 -0500
> @@ -216,7 +216,7 @@ static int selinux_xfrm_sec_ctx_alloc(st
>  		return -ENOMEM;
>  
>  	*ctxp = ctx = kmalloc(sizeof(*ctx) +
> -			      uctx->ctx_len,
> +			      uctx->ctx_len + 1,
>  			      GFP_KERNEL);
>  
>  	if (!ctx)
> @@ -229,6 +229,7 @@ static int selinux_xfrm_sec_ctx_alloc(st
>  	memcpy(ctx->ctx_str,
>  	       uctx+1,
>  	       ctx->ctx_len);
> +	ctx->ctx_str[ctx->ctx_len] = 0;
>  	rc = security_context_to_sid(ctx->ctx_str,
>  				     ctx->ctx_len,
>  				     &ctx->ctx_sid);

At the moment I am working on a re-work of the xfrm_audit_log() so 
that we can audit RFC-required events as well. I will add this fix into
the new patch and send to netdev. Venkat, I will include your ack
and cc you in the submission. Let me know if this is ok.

Regards, 
Joy

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

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

* Re: [PATCH] selinux_xfrm_sec_ctx_alloc: null-terminate context string
  2007-07-24 16:22 ` Joy Latten
@ 2007-07-24 16:45   ` Joy Latten
  0 siblings, 0 replies; 5+ messages in thread
From: Joy Latten @ 2007-07-24 16:45 UTC (permalink / raw)
  To: Venkat Yekkirala; +Cc: selinux, jmorris, sds

On Tue, 2007-07-24 at 11:22 -0500, Joy Latten wrote:
> On Tue, 2007-07-24 at 09:53 -0500, Venkat Yekkirala wrote:
> > xfrm_audit_log() expects the context string to be null-terminated
> > which currently doesn't happen with user-supplied contexts.
> > 
> > Signed-off-by: Venkat Yekkirala <vyekkirala@TrustedCS.com>
> > ---
> >  security/selinux/xfrm.c |    3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > --- selinux-2.6/security/selinux/xfrm.c	2007-07-24 09:43:23.000000000 -0500
> > +++ selinux-2.6/security/selinux/xfrm.c	2007-07-24 09:44:11.000000000 -0500
> > @@ -216,7 +216,7 @@ static int selinux_xfrm_sec_ctx_alloc(st
> >  		return -ENOMEM;
> >  
> >  	*ctxp = ctx = kmalloc(sizeof(*ctx) +
> > -			      uctx->ctx_len,
> > +			      uctx->ctx_len + 1,
> >  			      GFP_KERNEL);
> >  
> >  	if (!ctx)
> > @@ -229,6 +229,7 @@ static int selinux_xfrm_sec_ctx_alloc(st
> >  	memcpy(ctx->ctx_str,
> >  	       uctx+1,
> >  	       ctx->ctx_len);
> > +	ctx->ctx_str[ctx->ctx_len] = 0;
> >  	rc = security_context_to_sid(ctx->ctx_str,
> >  				     ctx->ctx_len,
> >  				     &ctx->ctx_sid);
> 
> At the moment I am working on a re-work of the xfrm_audit_log() so 
> that we can audit RFC-required events as well. I will add this fix into
> the new patch and send to netdev. Venkat, I will include your ack
> and cc you in the submission. Let me know if this is ok.
> 
Oops! This patch is not in xfrm_audit_log() code. So, I won't be
including it in my patch or anything. Sorry, didn't have my coffee
yet. :-)

Regards,
Joy



--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

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

* Re: [PATCH] selinux_xfrm_sec_ctx_alloc: null-terminate context string
  2007-07-24 14:53 [PATCH] selinux_xfrm_sec_ctx_alloc: null-terminate context string Venkat Yekkirala
  2007-07-24 16:22 ` Joy Latten
@ 2007-07-24 19:20 ` Stephen Smalley
  2007-07-24 20:44   ` James Morris
  1 sibling, 1 reply; 5+ messages in thread
From: Stephen Smalley @ 2007-07-24 19:20 UTC (permalink / raw)
  To: Venkat Yekkirala; +Cc: selinux, jmorris, latten

On Tue, 2007-07-24 at 09:53 -0500, Venkat Yekkirala wrote:
> xfrm_audit_log() expects the context string to be null-terminated
> which currently doesn't happen with user-supplied contexts.
> 
> Signed-off-by: Venkat Yekkirala <vyekkirala@TrustedCS.com>

Acked-by:  Stephen Smalley <sds@tycho.nsa.gov>

> ---
>  security/selinux/xfrm.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> --- selinux-2.6/security/selinux/xfrm.c	2007-07-24 09:43:23.000000000 -0500
> +++ selinux-2.6/security/selinux/xfrm.c	2007-07-24 09:44:11.000000000 -0500
> @@ -216,7 +216,7 @@ static int selinux_xfrm_sec_ctx_alloc(st
>  		return -ENOMEM;
>  
>  	*ctxp = ctx = kmalloc(sizeof(*ctx) +
> -			      uctx->ctx_len,
> +			      uctx->ctx_len + 1,
>  			      GFP_KERNEL);
>  
>  	if (!ctx)
> @@ -229,6 +229,7 @@ static int selinux_xfrm_sec_ctx_alloc(st
>  	memcpy(ctx->ctx_str,
>  	       uctx+1,
>  	       ctx->ctx_len);
> +	ctx->ctx_str[ctx->ctx_len] = 0;
>  	rc = security_context_to_sid(ctx->ctx_str,
>  				     ctx->ctx_len,
>  				     &ctx->ctx_sid);
-- 
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

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

* Re: [PATCH] selinux_xfrm_sec_ctx_alloc: null-terminate context string
  2007-07-24 19:20 ` Stephen Smalley
@ 2007-07-24 20:44   ` James Morris
  0 siblings, 0 replies; 5+ messages in thread
From: James Morris @ 2007-07-24 20:44 UTC (permalink / raw)
  To: Stephen Smalley; +Cc: Venkat Yekkirala, selinux, latten

On Tue, 24 Jul 2007, Stephen Smalley wrote:

> On Tue, 2007-07-24 at 09:53 -0500, Venkat Yekkirala wrote:
> > xfrm_audit_log() expects the context string to be null-terminated
> > which currently doesn't happen with user-supplied contexts.
> > 
> > Signed-off-by: Venkat Yekkirala <vyekkirala@TrustedCS.com>
> 
> Acked-by:  Stephen Smalley <sds@tycho.nsa.gov>


Applied to 
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6.git#for-linus


-- 
James Morris
<jmorris@namei.org>

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

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

end of thread, other threads:[~2007-07-24 20:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-24 14:53 [PATCH] selinux_xfrm_sec_ctx_alloc: null-terminate context string Venkat Yekkirala
2007-07-24 16:22 ` Joy Latten
2007-07-24 16:45   ` Joy Latten
2007-07-24 19:20 ` Stephen Smalley
2007-07-24 20:44   ` James Morris

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.