Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3897422pxb; Tue, 2 Mar 2021 01:06:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1/i4dveL6NyFrxZvujF/5YxPo6LDUWwPbEk9F8k5mdY+ZEbLS/K00tQ6syRKD7nB3Jsb7 X-Received: by 2002:a05:6402:1d92:: with SMTP id dk18mr8422223edb.161.1614675964008; Tue, 02 Mar 2021 01:06:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614675964; cv=none; d=google.com; s=arc-20160816; b=jYsywmEQcqOUSljaLgDadgKtoKUAh/lUQObXm8TikUSbI1YCBUm8BwCSCsWAuAIuf+ B3h2bAYsdl6qlGDvHWfat6U+ye+FLbNO4O+mO1v/IB6gAtALCxqLGf/bJVwunlP0qF+v uagyssEuBtF/gAddy5sOTrBKFJCQ5DRYlN9znKPTH5MpmSZfnRhHiP67szuwNmndArw1 78Rk8br4xl9+BlmeLJxFpU9OaLVfB5n6CbbEVo+mj/DzGCi4Z2kzlp4IwXuIPpFVxfhh vky+aZlc2u1vK+IItTSh6QMech9rSm4Siqr+WOrylq48h/KKgN0KVKMiiA7dVwBCccf/ TinA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=vltDR6nPmExSVgix/uycZqbK9vu4qx0KGQAFBNxtb08=; b=Ot7AFVSwTxMBTYUunYxQjLgvoGsPjXP6/pY+UljYU1J+BX3ZSTVWdrxaI4hYw5gkOw i7ki0moOMOilkPjppSCX5nIe0GMHrbC40W/FIUjJe1kynMnBAnlWiQd8SjWmJQXPNJDw 2n68NfQYDSoNiRQRmOURdtmxJtkAg/iWTz1hU21szvdDow0GnSw0Os8rKg2MJk8Yawsn dpRn48aGyugD4bbYNN4qpCkWXtztyleseMV65PKQcveSA2Dk3XctRcTXFrlKeywBT1BI S8L7XbwvIYUIGo7o8X29QvqqlcK6KOt8AONkacdw0mF1a2CqfNTWnsfi/xk8bl1qDomH W7iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dWjxltLx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b65si8576425edf.391.2021.03.02.01.05.41; Tue, 02 Mar 2021 01:06:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dWjxltLx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345591AbhCBBX1 (ORCPT + 99 others); Mon, 1 Mar 2021 20:23:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240962AbhCATGf (ORCPT ); Mon, 1 Mar 2021 14:06:35 -0500 Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C299C061788 for ; Mon, 1 Mar 2021 11:05:55 -0800 (PST) Received: by mail-qk1-x735.google.com with SMTP id s7so7583863qkg.4 for ; Mon, 01 Mar 2021 11:05:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vltDR6nPmExSVgix/uycZqbK9vu4qx0KGQAFBNxtb08=; b=dWjxltLxoMhu/cGdlWbJGFN82TRnUTSvcNFt8VbU0lJPhoQbyfb9qzf+Rlm36dRTfn R4+hBO+2Df9oSjPSSLAn7AXckKPvLPAeUFHiE9/FQmI/a9jYcKrc9mPne65dElaL/dwH zB0pReX7kaNRSciF9JwHZy0YqNsYCQHss6Nro4gmT0BBOtw4lurDzuMId5uiwx84/3d+ l8IbWc1Qrf7e+bxs2ZHmvHVVs4AA3Yj7fkx6LxNjewK/Yv1zDDHf71BAvOUZaobPg8j1 JMe/8fz2zB0TeGw+yvzzm+V8KWpgLOD5i7ZDNI9W3fZdYFr2fTpvwknrsDTsO+tAxKAE 1lpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vltDR6nPmExSVgix/uycZqbK9vu4qx0KGQAFBNxtb08=; b=cV14soCHm5pUtmroQySHYe7MgVk/P4IuY+uaBV91xpftVLbCNHBErxeSuz44uJYHMB ljmlJCNAP32Q6qQc/DP7K5/NidX1EUZQ4VltdmnfgbPZJNhfUGd3dRPD2SaSGiBeTxNa Z9QGHKRkXJGY1e6iBSPcZ76jucgN4YkuxWzHEHB9Rq5+3QWJ/k5eXbGK3bgNJUHDiCJi GpsdD7laFdl1X0pbBu6f2RmIdDGOxaFgRyQolBTD5WDKy5daM31uCAJDol4kH97b8iuZ iWH9S9x358f+t60Hu9jxdeJS8YiB7sb7Aw4KPQJPJBVbmTigKM087XQv9PZ/0iYXw3Gv 3AiA== X-Gm-Message-State: AOAM530WEoHKnDgrdw43sjYKrvmKqgr/zXxKIMTuJs9F/HWQkfrWxj0B lCMmiMYSOERc0FGAOZ4KIMVV7mFOzLz1y+Eqa43EZg== X-Received: by 2002:a37:4743:: with SMTP id u64mr9584887qka.350.1614625554022; Mon, 01 Mar 2021 11:05:54 -0800 (PST) MIME-Version: 1.0 References: <000000000000911d3905b459824c@google.com> <000000000000e56a2605b616b2d9@google.com> In-Reply-To: From: Dmitry Vyukov Date: Mon, 1 Mar 2021 20:05:42 +0100 Message-ID: Subject: Re: memory leak in bpf To: Rustam Kovhaev Cc: syzbot , andrii@kernel.org, Alexei Starovoitov , bpf , Daniel Borkmann , John Fastabend , Martin KaFai Lau , KP Singh , LKML , netdev , Song Liu , syzkaller-bugs , Yonghong Song , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 1, 2021 at 5:21 PM Rustam Kovhaev wrote: > > On Wed, Dec 09, 2020 at 10:58:10PM -0800, syzbot wrote: > > syzbot has found a reproducer for the following issue on: > > > > HEAD commit: a68a0262 mm/madvise: remove racy mm ownership check > > git tree: upstream > > console output: https://syzkaller.appspot.com/x/log.txt?x=11facf17500000 > > kernel config: https://syzkaller.appspot.com/x/.config?x=4305fa9ea70c7a9f > > dashboard link: https://syzkaller.appspot.com/bug?extid=f3694595248708227d35 > > compiler: gcc (GCC) 10.1.0-syz 20200507 > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=159a9613500000 > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11bf7123500000 > > > > IMPORTANT: if you fix the issue, please add the following tag to the commit: > > Reported-by: syzbot+f3694595248708227d35@syzkaller.appspotmail.com > > > > Debian GNU/Linux 9 syzkaller ttyS0 > > Warning: Permanently added '10.128.0.9' (ECDSA) to the list of known hosts. > > executing program > > executing program > > executing program > > BUG: memory leak > > unreferenced object 0xffff88810efccc80 (size 64): > > comm "syz-executor334", pid 8460, jiffies 4294945724 (age 13.850s) > > hex dump (first 32 bytes): > > c0 cb 14 04 00 ea ff ff c0 c2 11 04 00 ea ff ff ................ > > c0 56 3f 04 00 ea ff ff 40 18 38 04 00 ea ff ff .V?.....@.8..... > > backtrace: > > [<0000000036ae98a7>] kmalloc_node include/linux/slab.h:575 [inline] > > [<0000000036ae98a7>] bpf_ringbuf_area_alloc kernel/bpf/ringbuf.c:94 [inline] > > [<0000000036ae98a7>] bpf_ringbuf_alloc kernel/bpf/ringbuf.c:135 [inline] > > [<0000000036ae98a7>] ringbuf_map_alloc kernel/bpf/ringbuf.c:183 [inline] > > [<0000000036ae98a7>] ringbuf_map_alloc+0x1be/0x410 kernel/bpf/ringbuf.c:150 > > [<00000000d2cb93ae>] find_and_alloc_map kernel/bpf/syscall.c:122 [inline] > > [<00000000d2cb93ae>] map_create kernel/bpf/syscall.c:825 [inline] > > [<00000000d2cb93ae>] __do_sys_bpf+0x7d0/0x30a0 kernel/bpf/syscall.c:4381 > > [<000000008feaf393>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 > > [<00000000e1f53cfd>] entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > > > > > i am pretty sure that this one is a false positive > the problem with reproducer is that it does not terminate all of the > child processes that it spawns > > i confirmed that it is a false positive by tracing __fput() and > bpf_map_release(), i ran reproducer, got kmemleak report, then i > manually killed those running leftover processes from reproducer and > then both functions were executed and memory was freed > > i am marking this one as: > #syz invalid Hi Rustam, Thanks for looking into this. I wonder how/where are these objects referenced? If they are not leaked and referenced somewhere, KMEMLEAK should not report them as leaks. So even if this is a false positive for BPF, this is a true positive bug and something to fix for KMEMLEAK ;) And syzbot will probably re-create this bug report soon as this still happens and is not a one-off thing.