Commit 33e9e241 authored by Christoph Lameter's avatar Christoph Lameter Committed by Linus Torvalds

SLUB Debug: fix check for super sized slabs (>512k 64bit, >256k 32bit)

The check for super sized slabs where we can no longer move the free
pointer behind the object for debugging purposes etc is accessing a
field that is not setup yet.  We must use objsize here since the size of
the slab has not been determined yet.

The effect of this is that a global slab shrink via "slabinfo -s" will
show errors about offsets being wrong if booted with slub_debug.
Potentially there are other troubles with huge slabs under slub_debug
because the calculated free pointer offset is truncated.
Signed-off-by: default avatarChristoph Lameter <clameter@sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 418508c1
...@@ -939,7 +939,7 @@ static void kmem_cache_open_debug_check(struct kmem_cache *s) ...@@ -939,7 +939,7 @@ static void kmem_cache_open_debug_check(struct kmem_cache *s)
* Debugging or ctor may create a need to move the free * Debugging or ctor may create a need to move the free
* pointer. Fail if this happens. * pointer. Fail if this happens.
*/ */
if (s->size >= 65535 * sizeof(void *)) { if (s->objsize >= 65535 * sizeof(void *)) {
BUG_ON(s->flags & (SLAB_RED_ZONE | SLAB_POISON | BUG_ON(s->flags & (SLAB_RED_ZONE | SLAB_POISON |
SLAB_STORE_USER | SLAB_DESTROY_BY_RCU)); SLAB_STORE_USER | SLAB_DESTROY_BY_RCU));
BUG_ON(s->ctor); BUG_ON(s->ctor);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment