Re: [PATCH] kmemcheck: add hooks for the page allocator

Pekka Enberg
2009-02-21T16:38:37Z

Vegard Nossum wrote:
> This adds support for tracking the initializedness of memory that
> was allocated with the page allocator. Highmem requests are not
> tracked.
>
> Cc: Dave Hansen <dave@linux.vnet.ibm.com>
> Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>

Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>

> +void kmemcheck_pagealloc_alloc(struct page *page, unsigned int order,
> + gfp_t gfpflags)
> +{
> + int pages;
> +
> + if (gfpflags & (__GFP_HIGHMEM | __GFP_NOTRACK))
> + return;
> +
> + pages = 1 << order;
> +
> + /*
> + * NOTE: We choose to track GFP_ZERO pages too; in fact, they
> + * can become uninitialized by copying uninitialized memory
> + * into them.
> + */
> +
> + /* XXX: Can use zone->node for node? */
> + kmemcheck_alloc_shadow(page, order, gfpflags, -1);

Yes, you can.