Re: [linux-next-20130422] Bug in SLAB?

From: Christoph Lameter
Date: Thu May 02 2013 - 16:54:05 EST


On Wed, 1 May 2013, Tetsuo Handa wrote:

> The culprit location is possibly in SLAB because the kernel boots if built with
> CONFIG_DEBUG_SLAB=n || CONFIG_DEBUG_SPINLOCK=n || CONFIG_DEBUG_PAGEALLOC=n.

I have booted such a configuration just fine. Please have a look at the
kernel config that I send or send me yours.

Here is a patch that restores the old behavior for SLAB



Subject: slab: Return NULL for oversized allocations

The inline path seems to have changed the SLAB behavior for very large
kmalloc allocations. This patch restores the old behavior.

Signed-off-by: Christoph Lameter <cl@xxxxxxxxx>


Index: linux/include/linux/slab_def.h
===================================================================
--- linux.orig/include/linux/slab_def.h 2013-05-02 15:02:45.864728115 -0500
+++ linux/include/linux/slab_def.h 2013-05-02 15:06:14.940474110 -0500
@@ -126,6 +126,9 @@ static __always_inline void *kmalloc(siz
if (!size)
return ZERO_SIZE_PTR;

+ if (size >= KMALLOC_MAX_SIZE)
+ return NULL;
+
i = kmalloc_index(size);

#ifdef CONFIG_ZONE_DMA
@@ -172,6 +175,9 @@ static __always_inline void *kmalloc_nod
if (!size)
return ZERO_SIZE_PTR;

+ if (size > KMALLOC_MAX_SIZE)
+ return NULL;
+
i = kmalloc_index(size);

#ifdef CONFIG_ZONE_DMA
--
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/