All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH ckpt-v15] allocate checkpoint headers with kzalloc
@ 2009-05-13 15:55 Nathan Lynch
       [not found] ` <m3zldhxai8.fsf-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Lynch @ 2009-05-13 15:55 UTC (permalink / raw)
  To: Linux Containers

In a checkpoint image I noticed a lot of 0x6b (POISON_FREE) bytes
corresponding to checkpoint_restart_block -- this indicates that we
would write uninitialized kernel memory to the image in cases where
slab allocator debugging is not enabled[1].

Use kzalloc in ckpt_hdr_get.

[1] slub's debug mode apparently initializes allocated buffers to
POISON_FREE instead of POISON_INUSE, which confused me for a bit.
Maybe I don't understand the intended meanings of the poison values.

Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
---
 checkpoint/sys.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/checkpoint/sys.c b/checkpoint/sys.c
index 255ebc1..34a226c 100644
--- a/checkpoint/sys.c
+++ b/checkpoint/sys.c
@@ -117,7 +117,7 @@ int ckpt_kread(struct ckpt_ctx *ctx, void *addr, int count)
  */
 void *ckpt_hdr_get(struct ckpt_ctx *ctx, int len)
 {
-	return kmalloc(len, GFP_KERNEL);
+	return kzalloc(len, GFP_KERNEL);
 }
 
 /**
-- 
1.6.0.6

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

* Re: [PATCH ckpt-v15] allocate checkpoint headers with kzalloc
       [not found] ` <m3zldhxai8.fsf-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
@ 2009-05-13 17:02   ` Serge E. Hallyn
       [not found]     ` <20090513170257.GA18675-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  2009-05-14 16:32   ` Oren Laadan
  1 sibling, 1 reply; 4+ messages in thread
From: Serge E. Hallyn @ 2009-05-13 17:02 UTC (permalink / raw)
  To: Nathan Lynch; +Cc: Linux Containers

Quoting Nathan Lynch (ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org):
> In a checkpoint image I noticed a lot of 0x6b (POISON_FREE) bytes
> corresponding to checkpoint_restart_block -- this indicates that we
> would write uninitialized kernel memory to the image in cases where
> slab allocator debugging is not enabled[1].
> 
> Use kzalloc in ckpt_hdr_get.

Yikes, yes, that's on par with a recent ecryptfs bug that did the
same thing.

Have you audited for other such potential privileged data leaks?
(besides "all sysvipc" which we know about :)

thanks,
-serge

> [1] slub's debug mode apparently initializes allocated buffers to
> POISON_FREE instead of POISON_INUSE, which confused me for a bit.
> Maybe I don't understand the intended meanings of the poison values.
> 
> Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
> ---
>  checkpoint/sys.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/checkpoint/sys.c b/checkpoint/sys.c
> index 255ebc1..34a226c 100644
> --- a/checkpoint/sys.c
> +++ b/checkpoint/sys.c
> @@ -117,7 +117,7 @@ int ckpt_kread(struct ckpt_ctx *ctx, void *addr, int count)
>   */
>  void *ckpt_hdr_get(struct ckpt_ctx *ctx, int len)
>  {
> -	return kmalloc(len, GFP_KERNEL);
> +	return kzalloc(len, GFP_KERNEL);
>  }
> 
>  /**
> -- 
> 1.6.0.6
> 
> _______________________________________________
> Containers mailing list
> Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linux-foundation.org/mailman/listinfo/containers

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

* Re: [PATCH ckpt-v15] allocate checkpoint headers with kzalloc
       [not found]     ` <20090513170257.GA18675-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2009-05-13 17:25       ` Nathan Lynch
  0 siblings, 0 replies; 4+ messages in thread
From: Nathan Lynch @ 2009-05-13 17:25 UTC (permalink / raw)
  To: Serge E. Hallyn; +Cc: Linux Containers

"Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> writes:

> Quoting Nathan Lynch (ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org):
>> In a checkpoint image I noticed a lot of 0x6b (POISON_FREE) bytes
>> corresponding to checkpoint_restart_block -- this indicates that we
>> would write uninitialized kernel memory to the image in cases where
>> slab allocator debugging is not enabled[1].
>> 
>> Use kzalloc in ckpt_hdr_get.
>
> Yikes, yes, that's on par with a recent ecryptfs bug that did the
> same thing.
>
> Have you audited for other such potential privileged data leaks?
> (besides "all sysvipc" which we know about :)

No, haven't audited other things; the strings of 0x6b just caught my eye
and this looked like the obvious fix.  As general rule, I'd say the
checkpoint code should be zeroing any intermediate buffers that could be
written to the image.

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

* Re: [PATCH ckpt-v15] allocate checkpoint headers with kzalloc
       [not found] ` <m3zldhxai8.fsf-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
  2009-05-13 17:02   ` Serge E. Hallyn
@ 2009-05-14 16:32   ` Oren Laadan
  1 sibling, 0 replies; 4+ messages in thread
From: Oren Laadan @ 2009-05-14 16:32 UTC (permalink / raw)
  To: Nathan Lynch; +Cc: Linux Containers


Pushed on ckpt-v15-dev.

Thanks,

Oren.


Nathan Lynch wrote:
> In a checkpoint image I noticed a lot of 0x6b (POISON_FREE) bytes
> corresponding to checkpoint_restart_block -- this indicates that we
> would write uninitialized kernel memory to the image in cases where
> slab allocator debugging is not enabled[1].
> 
> Use kzalloc in ckpt_hdr_get.
> 
> [1] slub's debug mode apparently initializes allocated buffers to
> POISON_FREE instead of POISON_INUSE, which confused me for a bit.
> Maybe I don't understand the intended meanings of the poison values.
> 
> Signed-off-by: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
> ---
>  checkpoint/sys.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/checkpoint/sys.c b/checkpoint/sys.c
> index 255ebc1..34a226c 100644
> --- a/checkpoint/sys.c
> +++ b/checkpoint/sys.c
> @@ -117,7 +117,7 @@ int ckpt_kread(struct ckpt_ctx *ctx, void *addr, int count)
>   */
>  void *ckpt_hdr_get(struct ckpt_ctx *ctx, int len)
>  {
> -	return kmalloc(len, GFP_KERNEL);
> +	return kzalloc(len, GFP_KERNEL);
>  }
>  
>  /**

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

end of thread, other threads:[~2009-05-14 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-13 15:55 [PATCH ckpt-v15] allocate checkpoint headers with kzalloc Nathan Lynch
     [not found] ` <m3zldhxai8.fsf-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2009-05-13 17:02   ` Serge E. Hallyn
     [not found]     ` <20090513170257.GA18675-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-05-13 17:25       ` Nathan Lynch
2009-05-14 16:32   ` 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.