• Christoph Lameter's avatar
    slub: validation of slabs (metadata and guard zones) · 53e15af0
    Christoph Lameter authored
    This enables validation of slab.  Validation means that all objects are
    checked to see if there are redzone violations, if padding has been
    overwritten or any pointers have been corrupted.  Also checks the consistency
    of slab counters.
    
    Validation enables the detection of metadata corruption without the kernel
    having to execute code that actually uses (allocs/frees) and object.  It
    allows one to make sure that the slab metainformation and the guard values
    around an object have not been compromised.
    
    A single slabcache can be checked by writing a 1 to the "validate" file.
    
    i.e.
    
    echo 1 >/sys/slab/kmalloc-128/validate
    
    or use the slabinfo tool to check all slabs
    
    slabinfo -v
    
    Error messages will show up in the syslog.
    
    Note that validation can only reach slabs that are on a list.  This means that
    we are usually restricted to partial slabs and active slabs unless
    SLAB_STORE_USER is active which will build a full slab list and allows
    validation of slabs that are fully in use.  Booting with "slub_debug" set will
    enable SLAB_STORE_USER and then full diagnostic are available.
    
    Note that we attempt to push cpu slabs back to the lists when we start the
    check.  If the cpu slab is reactivated before we get to it (another processor
    grabs it before we get to it) then it cannot be checked.
    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>
    53e15af0
slub.c 75.1 KB