Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1360582ybx; Thu, 31 Oct 2019 09:27:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzH+aXyHcBXSwf7wIjz6NKd9gnnUEtcGZN73n022yVipigQf0xobrOzLf836hscpSnnKZxa X-Received: by 2002:aa7:d709:: with SMTP id t9mr5592073edq.266.1572539232167; Thu, 31 Oct 2019 09:27:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572539232; cv=none; d=google.com; s=arc-20160816; b=dBEN+DPOu0ayxTGbriiuT9X5aARubjyKK5m3Qersk1+qJv18G1w9eg5uYkh96AVdKK NaPuC+Jyn2y2kxpnfHqKUyAzGMA5bamrxOQNsdmFYq7juzbndjqUtez6fsj1bm0hM9Qd KrYrNeit2NNSKnmhTGH6COVqNA6Ou56mvM/8QGNGtY1nwt8/B94TDLnrwd2H6hyzlTeS Cg4byxMDRZlyPIjr9oswi5htixwqRVGh0k1t4VtHOBd2Zb1GquKgnQV8zE/poAvIEeVQ K7P7ZHnx4t6CpOgKgyb3+fRrl4PBdBM368AXk7i9J/jp6FeM6RwO9izOiJe2r2IL4X4W qmKw== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ciET5zZMdB4pJ11vI5qomBxM/l1ZE8whGPY1gejeEyw=; b=MkzXJmFO/UAOOmhIfIFa+XIbsf4yeSJKAfGgnMKT1YKbU6L1lorHwTntmBFF9RdtPI cBiYIgA5ehPJQcI+kGwIz3V4IkRKUlONP3mvQmxSrW5C/vIj98hPKg9h4rvAx6p7ksFm F9kZZtP/9zMoM9u6Fz2qWhqCOaD6SAYAqv3v1umCPZ7iG+akPt3Zy7YfLaFRVL+hnrF5 DKjaGiT7bNpPu6hLuGMBoW9bUvaXwuCaiMNttI8L4NdAKl5E/0MllU+X7L0HUJNOgOgp 4I4cvcywYHEHrb/5hLnkXD2uthOTGo1XPydzCcfOHks9qmPr6fqHhF5XugHUqw1CN84g 46Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=TPONw2Ri; 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 pv15si4032232ejb.346.2019.10.31.09.26.48; Thu, 31 Oct 2019 09:27:12 -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; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=TPONw2Ri; 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 S1728553AbfJaQZ0 (ORCPT + 99 others); Thu, 31 Oct 2019 12:25:26 -0400 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:51093 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727580AbfJaQZ0 (ORCPT ); Thu, 31 Oct 2019 12:25:26 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 1273E535E; Thu, 31 Oct 2019 12:25:25 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 31 Oct 2019 12:25:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=ciET5zZMdB4pJ11vI5qomBxM/l1ZE8whGPY1gejeE yw=; b=TPONw2RiqaN2UrYRFCm7Q85XKvLhUHvEAH4GbwOg/fvnYpPEG5j4bl8Wu kExovKf9j8oakVFZhLGGyKyt0CFrOYOBNLWW5+jNdAYVDr8uP3lsHNLbyJEsx0w8 XFFCVSyBWfjZiMVFID8QHNPjOfe2yUUi7Xg+2mJR4sJ9BOWjJpq8swcIz/kTgC6C 9JJIHPAtro/Czu8eIX7/7U3AVuO+dyK9ALVGeFDi87ex0dwa0xcw6YKZXcTp5pHZ 3YOO1TV/KhzQKjh4BH+46nzDmMOKRdfSJKnt9FAGdk+pw3gJHrjzLq5qDvDCE+se +96SbHFmZt3dJmcstRu+E1SlB1A6A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedruddthedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne goufhushhpvggtthffohhmrghinhculdegledmnecujfgurhepfffhvffukfhfgggtugfg jggfsehtkeertddtreejnecuhfhrohhmpefkughoucfutghhihhmmhgvlhcuoehiughosh gthhesihguohhstghhrdhorhhgqeenucffohhmrghinheprghpphhsphhothdrtghomhdp ohiilhgrsghsrdhorhhgnecukfhppeduleefrdegjedrudeihedrvdehudenucfrrghrrg hmpehmrghilhhfrhhomhepihguohhstghhsehiughoshgthhdrohhrghenucevlhhushht vghrufhiiigvpedt X-ME-Proxy: Received: from localhost (unknown [193.47.165.251]) by mail.messagingengine.com (Postfix) with ESMTPA id 4478880060; Thu, 31 Oct 2019 12:25:23 -0400 (EDT) Date: Thu, 31 Oct 2019 18:25:21 +0200 From: Ido Schimmel To: Dmitry Vyukov Cc: syzbot , Jiri Pirko , Alexei Starovoitov , bpf , Daniel Borkmann , David Miller , Jakub Kicinski , Martin KaFai Lau , LKML , netdev , Song Liu , syzkaller-bugs , Yonghong Song Subject: Re: general protection fault in process_one_work Message-ID: <20191031162521.GA31303@splinter> References: <0000000000001c46d5059608892f@google.com> <20191029084517.GA24289@splinter> <20191029165404.GA10996@splinter> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20191029165404.GA10996@splinter> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 29, 2019 at 06:54:07PM +0200, Ido Schimmel wrote: > On Tue, Oct 29, 2019 at 10:45:19AM +0200, Ido Schimmel wrote: > > On Tue, Oct 29, 2019 at 09:43:27AM +0100, Dmitry Vyukov wrote: > > > On Tue, Oct 29, 2019 at 9:38 AM syzbot > > > wrote: > > > > > > > > Hello, > > > > > > > > syzbot found the following crash on: > > > > > > > > HEAD commit: 38207291 bpf: Prepare btf_ctx_access for non raw_tp use case > > > > git tree: bpf-next > > > > console output: https://syzkaller.appspot.com/x/log.txt?x=14173c0f600000 > > > > kernel config: https://syzkaller.appspot.com/x/.config?x=41648156aa09be10 > > > > dashboard link: https://syzkaller.appspot.com/bug?extid=9ed8f68ab30761f3678e > > > > compiler: gcc (GCC) 9.0.0 20181231 (experimental) > > > > > > > > Unfortunately, I don't have any reproducer for this crash yet. > > > > > > > > IMPORTANT: if you fix the bug, please add the following tag to the commit: > > > > Reported-by: syzbot+9ed8f68ab30761f3678e@syzkaller.appspotmail.com > > > > > > +Jiří Pírko, this seems to be related to netdevsim. > > > > Will check it. > > Didn't have a lot of time today, but I think the issue is a race > condition (note that syzbot only triggered it twice so far). > > Upon reload nsim_dev_port_del_all() is called and starts deleting ports > from the ports list without holding the ports list mutex. It is possible > that during this time nsim_dev_trap_report_work() is executing from a > workqueue and accessing freed memory despite holding the ports list > mutex. > > I'll try to reproduce and send a fix later this week. Sent a fix: https://patchwork.ozlabs.org/patch/1187587/ It was quite difficult to reproduce, so I used the below patch to increase the time window in which the race could occur. Then it became trivial to trigger :) diff --git a/drivers/net/netdevsim/dev.c b/drivers/net/netdevsim/dev.c index 54ca6681ba31..d12abd84c218 100644 --- a/drivers/net/netdevsim/dev.c +++ b/drivers/net/netdevsim/dev.c @@ -457,6 +457,7 @@ static void nsim_dev_trap_report_work(struct work_struct *work) */ mutex_lock(&nsim_dev->port_list_lock); list_for_each_entry(nsim_dev_port, &nsim_dev->port_list, list) { + msleep(100); if (!netif_running(nsim_dev_port->ns->netdev)) continue;