• Dmitry Vyukov's avatar
    mm/kmemleak.c: fix check for softirq context · d3a0f212
    Dmitry Vyukov authored
    [ Upstream commit 6ef90569 ]
    
    in_softirq() is a wrong predicate to check if we are in a softirq
    context.  It also returns true if we have BH disabled, so objects are
    falsely stamped with "softirq" comm.  The correct predicate is
    in_serving_softirq().
    
    If user does cat from /sys/kernel/debug/kmemleak previously they would
    see this, which is clearly wrong, this is system call context (see the
    comm):
    
    unreferenced object 0xffff88805bd661c0 (size 64):
      comm "softirq", pid 0, jiffies 4294942959 (age 12.400s)
      hex dump (first 32 bytes):
        00 00 00 00 00 00 00 00 ff ff ff ff 00 00 00 00  ................
        00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00  ................
      backtrace:
        [<0000000007dcb30c>] kmemleak_alloc_recursive include/linux/kmemleak.h:55 [inline]
        [<0000000007dcb30c>] slab_post_alloc_hook mm/slab.h:439 [inline]
        [<0000000007dcb30c>] slab_alloc mm/slab.c:3326 [inline]
        [<0000000007dcb30c>] kmem_cache...
    d3a0f212
kmemleak.c 59 KB