• Jann Horn's avatar
    slub: Introduce CONFIG_SLUB_RCU_DEBUG · b8c8ba73
    Jann Horn authored
    Currently, KASAN is unable to catch use-after-free in SLAB_TYPESAFE_BY_RCU
    slabs because use-after-free is allowed within the RCU grace period by
    design.
    
    Add a SLUB debugging feature which RCU-delays every individual
    kmem_cache_free() before either actually freeing the object or handing it
    off to KASAN, and change KASAN to poison freed objects as normal when this
    option is enabled.
    
    For now I've configured Kconfig.debug to default-enable this feature in the
    KASAN GENERIC and SW_TAGS modes; I'm not enabling it by default in HW_TAGS
    mode because I'm not sure if it might have unwanted performance degradation
    effects there.
    
    Note that this is mostly useful with KASAN in the quarantine-based GENERIC
    mode; SLAB_TYPESAFE_BY_RCU slabs are basically always also slabs with a
    ->ctor, and KASAN's assign_tag() currently has to assign fixed tags for
    those, reducing the effectiveness of SW_TAGS/HW_TAGS mode.
    (A possible future extension of this work would be to also let SLUB call
    t...
    b8c8ba73
Kconfig.debug 11.2 KB