Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp356782imp; Thu, 21 Feb 2019 02:55:42 -0800 (PST) X-Google-Smtp-Source: AHgI3IY40F84+4yYwhgmK38R7BR0uI+/p8PNGgcP1gD/ZggGhiUr3sp2XGyquzTV4A7Ft6EHwfWr X-Received: by 2002:a62:c42:: with SMTP id u63mr39066202pfi.73.1550746542403; Thu, 21 Feb 2019 02:55:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550746542; cv=none; d=google.com; s=arc-20160816; b=zzYbZRbzL313n1sALOnZiUFG8m6hS4aG5kkmOUSQtTJsOsWvn1Ngx1mBUXF1L7jMz5 8q4yj144kXX6A0Wyk8Dk9tRE45/uXLrBy4jP72YxQNv2/G8yQYJOBV9Jutc8M8WlMgys TZdZbBDSSXxJAM+sVfIoru8eZbLvx7AS09fqQxxPASlv7QPi7wY455CualL4w8sH7K2G Vz0b7lAmqxAeiwALg5E1K4jK6Kvyso8ACaDpnsanHm5l67QFXj8QJy18xeGUmMqwtZ+Q kZIyxfXMPrlJZVuCwlNNjyt+RNZbjjFquMQwn3UbCOEYyynAKgKvuieg5+Ybt+hsy24Y EhYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=pkAeuej3gdZFNiFWlqKwdOkIgpTFqwzSdrNs/9nMtvM=; b=0UIglh/RAmsxRB0DtT9WLu8c9eTkUDzG3xaXk4Ly+3rUEOtf2FnZ++SLGJBZs21lPr CrhOXKpiAQ8PjR/H+70CC4Dimj0XJtzOyYZDKK3qzQnwQqo0rlk2ozUvyzyIdOMJWXVx MFYQQxrh0CZi5L3laJSTqv41qyCYgbFFfaW3VjM9GOp3FowNNzKSAEbYlJJ0m7O/INTU tR5/GeXs+gsPO+WAcUU9HItXdbmrV0rBUwF+8LtaSeAIsoPmNySsD0AW7kih2qvYVEDy Q72YInQ2gP1scgoKQ/IdJAjvnP5hb8CufkNlY26LoPAqw0sdNN4iOoghTtF1j8U+gpGx Ap+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Ip8+0gIr; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c15si8370056pgj.13.2019.02.21.02.55.25; Thu, 21 Feb 2019 02:55:42 -0800 (PST) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=Ip8+0gIr; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726437AbfBUKyy (ORCPT + 99 others); Thu, 21 Feb 2019 05:54:54 -0500 Received: from mail-it1-f196.google.com ([209.85.166.196]:38439 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725932AbfBUKyy (ORCPT ); Thu, 21 Feb 2019 05:54:54 -0500 Received: by mail-it1-f196.google.com with SMTP id l66so22119016itg.3 for ; Thu, 21 Feb 2019 02:54:54 -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=pkAeuej3gdZFNiFWlqKwdOkIgpTFqwzSdrNs/9nMtvM=; b=Ip8+0gIrEZSN5YIq+9JgarDrUD2oKawKiGhquHBepSQj2xKVBC3UwMRdAoU+ITPRGZ bwSCeIILbFqNQNoWV3lZyRfv1Ba4rMpgnfajjqwYc6RgS9uRFK/v/1i32UHHuVM9LkET 6lQUJw10Nwde0w/i7BLw4ms32C5w32HF8hEq2Q/31fAugzbbMow1lypDiaxj9N51UFXg 6AL57Ad3dSfTdprqnHsTpEOVyu95rskRqOje/TI6a6YVIJs1QFsE3M+cbl3mnR4EC3wc 2oRkjtMh3UiyVhvkxtzKmBtNReGQfFksRdLffw2JrcUUxszs4yMaxho1oLls1T3+tzjP YEoQ== 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=pkAeuej3gdZFNiFWlqKwdOkIgpTFqwzSdrNs/9nMtvM=; b=D3q1x/XuqgMALNxHJulxosYXpk0xNOSZMSY30jstf9yA+xoNb6qE+a7XeBT+HMUg4O kh6Jy2B6/Q3zGBxz4JKOJKkLdRA3S5vqG5SrrNyB0o75vavM2IghfaG/zx83+XMosTIn lqPNB7dTWp5kAYycMVKoMzngGc4fhaQjclVk8oCbG85xf5toOKCaaZ7Jad1VUhR8UVG4 JQAXm4u1hNiwyRiEVmn0ql1i8frAXc9d9r04p9njCiT3mpv2UeF2RMEXQRHJmJRsEcSS MUMQe3gPUAWvVuJJQ5VZ4BDK/u1HJDz5Fm/GrqJAJOJDAmqYIedc7zVSYrGBfa8e8wpF sDHQ== X-Gm-Message-State: AHQUAuYYgPcEXK7F3WSkHhfnwoPFYKQQA6/XJq3bEor5z6tC/XVc55W8 fdG3MNWvQ7ciomVKTSsjWvsjGtw5zO3rkTmnOB9XYw== X-Received: by 2002:a02:9089:: with SMTP id x9mr19657187jaf.72.1550746493511; Thu, 21 Feb 2019 02:54:53 -0800 (PST) MIME-Version: 1.0 References: <000000000000862b160580765e94@google.com> <3c44c1ff-2790-ec06-35c6-3572b92170c7@cumulusnetworks.com> <20190220102327.lq2zyqups2fso75z@gondor.apana.org.au> In-Reply-To: <20190220102327.lq2zyqups2fso75z@gondor.apana.org.au> From: Dmitry Vyukov Date: Thu, 21 Feb 2019 11:54:42 +0100 Message-ID: Subject: Re: KASAN: use-after-free Read in br_mdb_ip_get To: Herbert Xu Cc: Nikolay Aleksandrov , Thomas Graf , syzbot , bridge@lists.linux-foundation.org, David Miller , LKML , netdev , Roopa Prabhu , syzkaller-bugs Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 20, 2019 at 11:23 AM Herbert Xu wrote: > > On Mon, Jan 28, 2019 at 09:28:36AM +0100, Dmitry Vyukov wrote: > > > > > Weird, this is the kfree() on the error path of br_multicast_new_group() > > > when rhashtable_lookup_insert_fast() fails, which means the entry should > > > not be linked in the rhashtable or the hlist. > > > All other frees are via kfree_rcu. I'll keep looking.. > > > > Humm.... +rhashtable.c maintianers > > > > The code in br_multicast_new_group is effectively: > > > > mp = kzalloc(sizeof(*mp), GFP_ATOMIC); > > err = rhashtable_lookup_insert_fast(&br->mdb_hash_tbl, &mp->rhnode, > > br_mdb_rht_params); > > if (err) > > kfree(mp); > > > > So it looks like rhashtable_lookup_insert_fast both returned an error > > and left the new object linked in the table. Since it happened only > > once, it may have something to do with concurrent resizing/shrinking. > > I've looked through the rhashtable code in question and everything > looks OK. So I suspect some earlier corruption has occured to cause > this anomalous result. Taking into account that this still happened only once, I tend to write it off onto a previous silent memory corruption (we have dozens of known bugs that corrupt memory). So if several people already looked at it and don't see the root cause, it's probably time to stop spending time on this until we have more info. Although, there was also this one: https://groups.google.com/d/msg/syzkaller-bugs/QfCCSxdB1aM/y2cn9IZJCwAJ I have not checked if it can be the root cause of this report, but it points suspiciously close to this stack and when I looked at it, it the report looked legit. > Is it possible to collect earlier alloc/free stack traces on the object in question? You mean even before the alloc/free of the current incarnation this object? This looks challenging from memory consumption point of view. Also how many of them will we print in reports? Also the page can go through page_alloc and then tracking will be even more challenging. And in the end the object can be corrupted by an out-of-bounds write or a like. Heap object reuse quarantine should take care of the common case, and I don't see a reasonable way to handle all possible corner cases...