Re: [PATCH] slub: Potential stack overflow

From: Christoph Lameter
Date: Wed Mar 24 2010 - 17:10:27 EST


On Wed, 24 Mar 2010, Eric Dumazet wrote:

> @@ -3651,16 +3654,19 @@ static void process_slab(struct loc_track *t, struct kmem_cache *s,
> struct page *page, enum track_item alloc)
> {
> void *addr = page_address(page);
> - DECLARE_BITMAP(map, page->objects);
> + long *map = kzalloc(BITS_TO_LONGS(page->objects) * sizeof(long),
> + GFP_ATOMIC);
> void *p;
>
> - bitmap_zero(map, page->objects);
> + if (!map)
> + return;
> for_each_free_object(p, s, page->freelist)
> set_bit(slab_index(p, s, addr), map);
>
> for_each_object(p, s, addr, page->objects)
> if (!test_bit(slab_index(p, s, addr), map))
> add_location(t, s, get_track(s, p, alloc));
> + kfree(map);
> }
>

Hmmm... Thats another case. We should alloate the map higher up there I
guess and pass the address in so that one allocation can be used for all
slabs. validate_slab_cache() does that.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/