15 Oct, 2019

1 commit

  • Kmemleak is falsely reporting a leak of the slab allocation in
    sctp_stream_init_ext():

    BUG: memory leak
    unreferenced object 0xffff8881114f5d80 (size 96):
    comm "syz-executor934", pid 7160, jiffies 4294993058 (age 31.950s)
    hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    backtrace:
    [] kmemleak_alloc_recursive include/linux/kmemleak.h:55 [inline]
    [] slab_post_alloc_hook mm/slab.h:439 [inline]
    [] slab_alloc mm/slab.c:3326 [inline]
    [] kmem_cache_alloc_trace+0x13d/0x280 mm/slab.c:3553
    [] kmalloc include/linux/slab.h:547 [inline]
    [] kzalloc include/linux/slab.h:742 [inline]
    [] sctp_stream_init_ext+0x2b/0xa0 net/sctp/stream.c:157
    [] sctp_sendmsg_to_asoc+0x946/0xa00 net/sctp/socket.c:1882
    [] sctp_sendmsg+0x2a8/0x990 net/sctp/socket.c:2102
    [...]

    But it's freed later. Kmemleak misses the allocation because its
    pointer is stored in the generic radix tree sctp_stream::out, and the
    generic radix tree uses raw pages which aren't tracked by kmemleak.

    Fix this by adding the kmemleak hooks to the generic radix tree code.

    Link: http://lkml.kernel.org/r/20191004065039.727564-1-ebiggers@kernel.org
    Signed-off-by: Eric Biggers
    Reported-by:
    Reviewed-by: Marcelo Ricardo Leitner
    Acked-by: Neil Horman
    Reviewed-by: Catalin Marinas
    Cc: Kent Overstreet
    Cc: Vlad Yasevich
    Cc: Xin Long
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Biggers
     

26 Sep, 2019

1 commit

  • When building with W=1, we get some warnings:

    l CC lib/generic-radix-tree.o
    lib/generic-radix-tree.c:39:10: warning: no previous prototype for 'genradix_root_to_depth' [-Wmissing-prototypes]
    39 | unsigned genradix_root_to_depth(struct genradix_root *r)
    | ^~~~~~~~~~~~~~~~~~~~~~
    lib/generic-radix-tree.c:44:23: warning: no previous prototype for 'genradix_root_to_node' [-Wmissing-prototypes]
    44 | struct genradix_node *genradix_root_to_node(struct genradix_root *r)
    | ^~~~~~~~~~~~~~~~~~~~~

    They're not used anywhere else, so make them static inline.

    Link: http://lkml.kernel.org/r/46923.1565236485@turing-police
    Signed-off-by: Valdis Kletnieks
    Cc: Kent Overstreet
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Valdis Kletnieks
     

13 Mar, 2019

1 commit

  • Very simple radix tree implementation that supports storing arbitrary
    size entries, up to PAGE_SIZE - upcoming patches will convert existing
    flex_array users to genradixes. The new genradix code has a much
    simpler API and implementation, and doesn't have a hard limit on the
    number of elements like flex_array does.

    Link: http://lkml.kernel.org/r/20181217131929.11727-5-kent.overstreet@gmail.com
    Signed-off-by: Kent Overstreet
    Cc: Alexey Dobriyan
    Cc: Al Viro
    Cc: Dave Hansen
    Cc: Eric Paris
    Cc: Marcelo Ricardo Leitner
    Cc: Matthew Wilcox
    Cc: Neil Horman
    Cc: Paul Moore
    Cc: Pravin B Shelar
    Cc: Shaohua Li
    Cc: Stephen Smalley
    Cc: Vlad Yasevich
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kent Overstreet