Skip to content
  • Joonsoo Kim's avatar
    slab: fix oops when reading /proc/slab_allocators · 03787301
    Joonsoo Kim authored
    Commit b1cb0982 ("change the management method of free objects of
    the slab") introduced a bug on slab leak detector
    ('/proc/slab_allocators').  This detector works like as following
    decription.
    
     1. traverse all objects on all the slabs.
     2. determine whether it is active or not.
     3. if active, print who allocate this object.
    
    but that commit changed the way how to manage free objects, so the logic
    determining whether it is active or not is also changed.  In before, we
    regard object in cpu caches as inactive one, but, with this commit, we
    mistakenly regard object in cpu caches as active one.
    
    This intoduces kernel oops if DEBUG_PAGEALLOC is enabled.  If
    DEBUG_PAGEALLOC is enabled, kernel_map_pages() is used to detect who
    corrupt free memory in the slab.  It unmaps page table mapping if object
    is free and map it if object is active.  When slab leak detector check
    object in cpu caches, it mistakenly think this object active so try to
    access object memory...
    03787301