Skip to content
  • Andrey Konovalov's avatar
    kasan, mm: reset tags when accessing metadata · 9a628bf3
    Andrey Konovalov authored and Vincenzo Frascino's avatar Vincenzo Frascino committed
    
    
    Kernel allocator code accesses metadata for slab objects, that may lie
    out-of-bounds of the object itself, or be accessed when an object is freed.
    Such accesses trigger tag faults and lead to false-positive reports with
    hardware tag-based KASAN.
    
    Software KASAN modes disable instrumentation for allocator code via
    KASAN_SANITIZE Makefile macro, and rely on kasan_enable/disable_current()
    annotations which are used to ignore KASAN reports.
    
    With hardware tag-based KASAN neither of those options are available, as
    it doesn't use compiler instrumetation, no tag faults are ignored, and MTE
    is disabled after the first one.
    
    Instead, reset tags when accessing metadata (currently only for SLUB).
    
    Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
    Signed-off-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
    Acked-by: default avatarMarco Elver <elver@google.com>
    ---
    Change-Id: I39f3c4d4f29299d4fbbda039bedf230db1c746fb
    9a628bf3