Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp976621ybp; Fri, 4 Oct 2019 07:50:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzEqygyY1IBDN6TFMiVtezdQ0MO+w68NQvspd1i1elj4/CPT+wW4vuT6P6NSx5zT/4yCIrr X-Received: by 2002:a50:9f42:: with SMTP id b60mr15992710edf.192.1570200629759; Fri, 04 Oct 2019 07:50:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570200629; cv=none; d=google.com; s=arc-20160816; b=CcU94CLt5UpmWnA2fwkvTOzA3X9Bl62LsWZTMGH5yI/0zLru78hgvuGmhpJ5lC3E32 3cCgBi7OpnWCefrQJEvCDzAbJNJJ4FYROq47IxPKzMkqm7OxZyCAOtIEXbPJsZL9Kfb6 4G7wwYJ0I3d1Y4c3aRaOqjcOwGv/gD2TORvQV+90TevvWLkmRQZoXQwiiQ/KC0D32haf wPclCXIp8ucUJ3OF3tPGk8Bf+sXeQk2WAhY6GjIVpoMOCz6ymZ8fTetQrA+xecH0m4GN /3PUvXekGvGv9vpn3EvjLDKt+SZhiFWBn2sHqlYx1LG5xzjOs/aum/SazU2pAsg2P/H8 6FZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=3DHNpR/fbAobZ8bY6VG7W/0FXB1PN+sbgRhB2NlA4PM=; b=flKaz0WO8QEclSh+EEyuNW1VJhhJJQ1UXllG4x+Yrtg3UYBljGvJq5KRtQ9DXGe6/l vfLHdzuQmMD/QJzm4+iHDl4Tm3wbiJ7/X79/8zubTcyvLgkHVY6L/NRSskLU0ysdAlt3 jYIzu22uCUUvXZGzj1bDtqrDRObkLL+ikzB9wdQVX5nviGsF3tH3iHF3BdOGj7lS2MUY RFIjEC7g+ZZmm09OY3+br4h82r/F/b9THv6v2TP/+E8rIqhs2RV2Ykd9gWfVnglSNk00 c781Gw+NpnIJckLhYZB3qbWgfh0EIwKaxr9Nv40qy4/DGmt0FXbvXv17T/Y2zR+DHsQe 2MtQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s14si3934161edc.83.2019.10.04.07.50.04; Fri, 04 Oct 2019 07:50:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389400AbfJDOsp (ORCPT + 99 others); Fri, 4 Oct 2019 10:48:45 -0400 Received: from foss.arm.com ([217.140.110.172]:47296 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388870AbfJDOsp (ORCPT ); Fri, 4 Oct 2019 10:48:45 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EDE8F1597; Fri, 4 Oct 2019 07:48:44 -0700 (PDT) Received: from arrakis.emea.arm.com (arrakis.cambridge.arm.com [10.1.196.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 779DC3F68E; Fri, 4 Oct 2019 07:48:43 -0700 (PDT) Date: Fri, 4 Oct 2019 15:48:41 +0100 From: Catalin Marinas To: Eric Biggers Cc: Andrew Morton , linux-mm@kvack.org, linux-sctp@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, Kent Overstreet , Vlad Yasevich , Xin Long , Neil Horman , Marcelo Ricardo Leitner Subject: Re: [PATCH] lib/generic-radix-tree.c: add kmemleak annotations Message-ID: <20191004144841.GI638@arrakis.emea.arm.com> References: <20191004065039.727564-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191004065039.727564-1-ebiggers@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 03, 2019 at 11:50:39PM -0700, Eric Biggers wrote: > From: Eric Biggers > > 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: > [<00000000ce7a1326>] kmemleak_alloc_recursive include/linux/kmemleak.h:55 [inline] > [<00000000ce7a1326>] slab_post_alloc_hook mm/slab.h:439 [inline] > [<00000000ce7a1326>] slab_alloc mm/slab.c:3326 [inline] > [<00000000ce7a1326>] kmem_cache_alloc_trace+0x13d/0x280 mm/slab.c:3553 > [<000000007abb7ac9>] kmalloc include/linux/slab.h:547 [inline] > [<000000007abb7ac9>] kzalloc include/linux/slab.h:742 [inline] > [<000000007abb7ac9>] sctp_stream_init_ext+0x2b/0xa0 net/sctp/stream.c:157 > [<0000000048ecb9c1>] sctp_sendmsg_to_asoc+0x946/0xa00 net/sctp/socket.c:1882 > [<000000004483ca2b>] 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. > > Reported-by: syzbot+7f3b6b106be8dcdcdeec@syzkaller.appspotmail.com > Signed-off-by: Eric Biggers Reviewed-by: Catalin Marinas