• Jim Cromie's avatar
    kmemleak: drop (age <increasing>) from leak record · 88f9ee2b
    Jim Cromie authored
    Patch series "tweak kmemleak report format".
    
    These 2 patches make minor changes to the report:
    
    1st strips "age <increasing>" from output.  This makes the output
    idempotent; unchanging until a new leak is reported.
    
    2nd adds the backtrace.checksum to the "backtrace:" line.  This lets a
    user see repeats without actually reading the whole backtrace.  So now
    the backtrace line looks like this:
    
      backtrace (crc 603070071):
    
    I surveyed for un-wanted effects upon users:
    
    Syzkaller parses kmemleak in executor/common_linux.h:
    static void check_leaks(char** frames, int nframes)
    
    It just counts occurrences of "unreferenced object", specifically it
    does not look for "age", nor would it choke on "crc" being added.
    
    github has 3 repos with "kmemleak" mentioned, all are moribund.
    gitlab has 0 hits on "kmemleak".
    
    
    This patch (of 2):
    
    Displaying age is pretty, but counter-productive; it changes with
    current-time, so it surrenders idempotency of the output, which breaks
    simple hash-based cataloging of the records by the user.
    
    The trouble: sequential reads, wo new leaks, get new results:
    
      :#> sum /sys/kernel/debug/kmemleak
      53439    74 /sys/kernel/debug/kmemleak
      :#> sum /sys/kernel/debug/kmemleak
      59066    74 /sys/kernel/debug/kmemleak
    
    and age is why (nothing else changes):
    
      :#> grep -v age /sys/kernel/debug/kmemleak | sum
      58894    67
      :#> grep -v age /sys/kernel/debug/kmemleak | sum
      58894    67
    
    Since jiffies is already printed in the "comm" line, age adds nothing.
    
    Notably, syzkaller reads kmemleak only for "unreferenced object", and
    won't care about this reform of age-ism.  A few moribund github repos
    mention it, but don't compile.
    
    Link: https://lkml.kernel.org/r/20231116224318.124209-1-jim.cromie@gmail.com
    Link: https://lkml.kernel.org/r/20231116224318.124209-2-jim.cromie@gmail.com
    
    Signed-off-by: default avatarJim Cromie <jim.cromie@gmail.com>
    Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    88f9ee2b
kmemleak.c 62.1 KB