Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp509281imm; Thu, 31 May 2018 04:44:16 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIbnJ3I2YU2xJLsdr4YAKU1YhQSq8P36L164d5dhSbznkN1QHTBucOZRs8FQqIvTpoeyvHq X-Received: by 2002:a65:45c2:: with SMTP id m2-v6mr5210603pgr.189.1527767056923; Thu, 31 May 2018 04:44:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527767056; cv=none; d=google.com; s=arc-20160816; b=O+ky/2LyGkbfVh5shMTgJ35ax9oZq9DhPjQss9m6SmIW3n26RE8GZ0SJJ8/E86qytG dP7PE7l++s2ksmgsiGmTemB4Bv+B99rqnnSwLGGY/MFLMCzdr3vO5DOrQEb/I3ADDq5D aTuRedMaG0VCSQQv+bzbxmTbUc1xZ7GoodYQy5Uwl3ss34TDAJyeOOzBpGaqDvXE/dY2 1vJ2QC4LViIlLa182yYe4Yjssb1Dt7eGDzJPxqKHj5A6f0dBnVALS8Wx2hbCZxDQ9UVL oP1Cc0ZHTaSx3vSn/GzeDOVlbQG7kPNbvQYxk3nsHRxmFbixuT/EaJ96FHW9I7Zd3Of8 G4PQ== 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:arc-authentication-results; bh=0pWk/kIKSknnPP1CFjgkS4D2u5s+CKDXWM41AeLxgW4=; b=StyGuZOac4kOHHYafqBjqaO4wvTFKim+WnLPMzrAJGHog2nke4pprncGog8YC/JGvE Nay6Kx7jCL9f3WtQs6dMv5YeHNqOOSMPE2CUW06BUscPUEclE58DV9C7kY0Q9V0p3oHe z3IC+0Dqn4ceLvcu6GX7lM0sv1JrAwkACGidujZza/SwzZM90Vq4R0wDezfs38IPYxk3 I7syU/UaHQw9J5rUlfPGZUABKC5X0Ie03UEMOpDffGLSoK8PCtvuZKQ5YHVtK/8mprBb c3vIc+LE71mEsFsAFXsYcs0WHnOPQWL9tNuZJly7pNKNnBdg/2/Tw8aTYWR66KQh2oS9 LkOQ== 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 q19-v6si7954982pgn.392.2018.05.31.04.44.02; Thu, 31 May 2018 04:44:16 -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 S1754762AbeEaLmd (ORCPT + 99 others); Thu, 31 May 2018 07:42:33 -0400 Received: from mx2.suse.de ([195.135.220.15]:43565 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754522AbeEaLma (ORCPT ); Thu, 31 May 2018 07:42:30 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D7352AE92; Thu, 31 May 2018 11:42:28 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 632021E0D36; Thu, 31 May 2018 13:42:28 +0200 (CEST) Date: Thu, 31 May 2018 13:42:28 +0200 From: Jan Kara To: Tetsuo Handa Cc: Jan Kara , syzbot , syzkaller-bugs@googlegroups.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk, axboe@kernel.dk, tj@kernel.org, david@fromorbit.com, linux-block@vger.kernel.org Subject: Re: general protection fault in wb_workfn (2) Message-ID: <20180531114228.6zx27xxurmz27pke@quack2.suse.cz> References: <000000000000cbd959056d1851ca@google.com> <0c7c5dea-7312-8a59-9d1b-5467f69719bf@I-love.SAKURA.ne.jp> <20180528133503.awomzj6djozbo5bv@quack2.suse.cz> <2dda7a11-3f6b-bdba-a68a-7c0694806cc4@I-love.SAKURA.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2dda7a11-3f6b-bdba-a68a-7c0694806cc4@I-love.SAKURA.ne.jp> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 31-05-18 01:00:08, Tetsuo Handa wrote: > So, we have no idea what is happening... > Then, what about starting from temporary debug printk() patch shown below? > > >From 4f70f72ad3c9ae6ce1678024ef740aca4958e5b0 Mon Sep 17 00:00:00 2001 > From: Tetsuo Handa > Date: Wed, 30 May 2018 09:57:10 +0900 > Subject: [PATCH] bdi: Add temporary config for debugging wb_workfn() versus > bdi_unregister() race bug. > > syzbot is hitting NULL pointer dereference at wb_workfn() [1]. But due to > limitations that syzbot cannot find reproducer for this bug (frequency is > once or twice per a day) nor we can't capture vmcore in the environment > which syzbot is using, for now we need to rely on printk() debugging. > > [1] https://syzkaller.appspot.com/bug?id=e0818ccb7e46190b3f1038b0c794299208ed4206 > > Signed-off-by: Tetsuo Handa Hum a bit ugly solution but if others are fine with this, I can live with it for a while as well. Or would it be possible for syzkaller to just test some git tree where this patch is included? Then we would not even have to have the extra config option... > diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c > index 471d863..b4dd078 100644 > --- a/fs/fs-writeback.c > +++ b/fs/fs-writeback.c > @@ -1934,6 +1934,37 @@ void wb_workfn(struct work_struct *work) > struct bdi_writeback, dwork); > long pages_written; > > +#ifdef CONFIG_BLK_DEBUG_WB_WORKFN_RACE > + if (!wb->bdi->dev) { > + pr_warn("WARNING: %s: device is NULL\n", __func__); > + pr_warn("wb->state=%lx\n", wb->state); > + pr_warn("list_empty(&wb->work_list)=%u\n", > + list_empty(&wb->work_list)); > + if (!wb->bdi) This is not possible when we dereferences wb->bdi above... > + pr_warn("wb->bdi == NULL\n"); > + else { > + pr_warn("list_empty(&wb->bdi->bdi_list)=%u\n", > + list_empty(&wb->bdi->bdi_list)); > + pr_warn("wb->bdi->wb.state=%lx\n", wb->bdi->wb.state); > + } It would be also good to print whether wb == wb->bdi->wb (i.e. it is the default writeback structure or one for some cgroup) and also wb->bdi->wb.state. Honza > + if (!wb->congested) > + pr_warn("wb->congested == NULL\n"); > +#ifdef CONFIG_CGROUP_WRITEBACK > + else if (!wb->congested->__bdi) > + pr_warn("wb->congested->__bdi == NULL\n"); > + else { > + pr_warn("(wb->congested->__bdi == wb->bdi)=%u\n", > + wb->congested->__bdi == wb->bdi); > + pr_warn("list_empty(&wb->congested->__bdi->bdi_list)=%u\n", > + list_empty(&wb->congested->__bdi->bdi_list)); > + pr_warn("wb->congested->__bdi->wb.state=%lx\n", > + wb->congested->__bdi->wb.state); > + } > +#endif > + /* Will halt shortly due to NULL pointer dereference... */ > + } > +#endif > + > set_worker_desc("flush-%s", dev_name(wb->bdi->dev)); > current->flags |= PF_SWAPWRITE; > > -- > 1.8.3.1 > -- Jan Kara SUSE Labs, CR