From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53925C433E7 for ; Fri, 9 Oct 2020 14:56:47 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C14A322260; Fri, 9 Oct 2020 14:56:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sourceforge.net header.i=@sourceforge.net header.b="ZemwwqIw"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sf.net header.i=@sf.net header.b="M7BS4WwD"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="n56KezxU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C14A322260 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1kQtp5-0003t3-5V; Fri, 09 Oct 2020 14:56:43 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQtp3-0003sx-Qr for linux-f2fs-devel@lists.sourceforge.net; Fri, 09 Oct 2020 14:56:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ptkaw3vE3vJbkFBAZ4P40zC0MxU8bFP8Z8CUWmRXk6Y=; b=ZemwwqIw6H0aW4IEBZRN6UWY+h pcLx05IDmYzp4OyutPY8Ct81KaLP1PBghk6I/Sb/QDCamuOXfUO0yKMb6kRuYz/GhYwscjUqTzTTR aOxe+fFRWOJzGjo7XASqmfme5DsXxfjIjtOM8Cj8ucIzZg0USdzpfM+n/DMLFuMUWyw8=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ptkaw3vE3vJbkFBAZ4P40zC0MxU8bFP8Z8CUWmRXk6Y=; b=M7BS4WwDfJ0O/I/gZtAJj1Zchn oO8EOSv+sfxYqMcMnBx8dCGEMf6YBI2yZGBHKjjf9v7UQsYwspN2/mWbUk6QhSnx6ZzaFBqdWyBh7 UL2lAtMJy7Zq6VrNECG/K2YSpIYR+3fsjHZ2VtHaCyOhiAJnl4eTFbs1lebkxGMkJjpM=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1kQtoz-008ZWM-4F for linux-f2fs-devel@lists.sourceforge.net; Fri, 09 Oct 2020 14:56:41 +0000 Received: from localhost (unknown [104.132.1.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 97FC122260; Fri, 9 Oct 2020 14:56:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602255386; bh=eKhV1B1C+0JAvCUA9Ri5lD4cOPJVxC2GFBQ3mLOVFPA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=n56KezxUl1rJ7CHEXfPMwgL4X6ePZDUWhgcmiOs//2BIJL4oQAh7jxuNZwUDv6HdH 9lCiovSff1YidnCdP6rrwQr2kzstUh5SzAcEza5mHyjVhZrHDeKkgFJZVwQmf1C+/G Zqo8nFK5vq4RYg08vD8jwEoZ8wHpIB3v7TeRp7uk= Date: Fri, 9 Oct 2020 07:56:26 -0700 From: jaegeuk@kernel.org To: Chao Yu Message-ID: <20201009145626.GA2186792@google.com> References: <000000000000432c5405b1113296@google.com> <20201007213253.GD1530638@gmail.com> <20201007215305.GA714500@google.com> <20201009015015.GA1931838@google.com> <8fa4f9fe-5ca5-f3a3-c8f4-e800373c1e46@huawei.com> <20201009043237.GB1973455@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Headers-End: 1kQtoz-008ZWM-4F Subject: Re: [f2fs-dev] [f2fs bug] infinite loop in f2fs_get_meta_page_nofail() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Biggers , syzbot+ee250ac8137be41d7b13@syzkaller.appspotmail.com, syzkaller-bugs@googlegroups.com, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On 10/09, Chao Yu wrote: > On 2020/10/9 12:32, jaegeuk@kernel.org wrote: > > On 10/09, Chao Yu wrote: > > > On 2020/10/9 9:50, jaegeuk@kernel.org wrote: > > > > On 10/09, Chao Yu wrote: > > > > > On 2020/10/8 5:53, jaegeuk@kernel.org wrote: > > > > > > On 10/07, Eric Biggers wrote: > > > > > > > [moved linux-fsdevel to Bcc] > > > > > > > > > > > > > > On Wed, Oct 07, 2020 at 02:18:19AM -0700, syzbot wrote: > > > > > > > > Hello, > > > > > > > > > > > > > > > > syzbot found the following issue on: > > > > > > > > > > > > > > > > HEAD commit: a804ab08 Add linux-next specific files for 20201006 > > > > > > > > git tree: linux-next > > > > > > > > console output: https://syzkaller.appspot.com/x/log.txt?x=17fe30bf900000 > > > > > > > > kernel config: https://syzkaller.appspot.com/x/.config?x=26c1b4cc4a62ccb > > > > > > > > dashboard link: https://syzkaller.appspot.com/bug?extid=ee250ac8137be41d7b13 > > > > > > > > compiler: gcc (GCC) 10.1.0-syz 20200507 > > > > > > > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1336413b900000 > > > > > > > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12f7392b900000 > > > > > > > > > > > > > > > > The issue was bisected to: > > > > > > > > > > > > > > > > commit eede846af512572b1f30b34f9889d7df64c017d4 > > > > > > > > Author: Jaegeuk Kim > > > > > > > > Date: Fri Oct 2 21:17:35 2020 +0000 > > > > > > > > > > > > > > > > f2fs: f2fs_get_meta_page_nofail should not be failed > > > > > > > > > > > > > > > > > > > > > > Jaegeuk, it looks like the loop you added in the above commit doesn't terminate > > > > > > > if the requested page is beyond the end of the device. > > > > > > > > > > > > Yes, that will go infinite loop. Otherwise, it will trigger a panic during > > > > > > the device reboot. Let me think how to avoid that before trying to get the > > > > > > wrong lba access. > > > > > > > > > > Delivering f2fs_get_sum_page()'s return value needs a lot of codes change, I think > > > > > we can just zeroing sum_page in error case, as we have already shutdown f2fs via > > > > > calling f2fs_stop_checkpoint(), then f2fs_cp_error() will stop all updates to > > > > > filesystem data including summary pages. > > > > > > > > That sounds like one solution tho, I'm afraid of getting another panic by > > > > wrong zero'ed summary page. > > > > > > What case do you mean? maybe I missed some corner cases? > > > > I sent v2 to fix syzbot issue, which fixes wrong use of > > f2fs_get_meta_page_nofail. > > I agreed to fix that case, however we may encounter deadloop in other > places where we call f2fs_get_meta_page_nofail()? like the case that > filesystem will always see EIO after we shutdown device via dmflakey? We may need another option to deal with this. At least, however, it's literally _nofail function which should guarantee no error, instead of hiding the error with zero'ed page. > > Thanks, > > > > > > > > > Thanks, > > > > > > > > > > > > > > > > > Thoughts? > > > > > > > > > > Thanks, > > > > > > > > > > > > > > > > > > > > > > > > > - Eric > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Linux-f2fs-devel mailing list > > > > > > Linux-f2fs-devel@lists.sourceforge.net > > > > > > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel > > > > > > . > > > > > > > > > > . > > > > > > . > > _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B905AC433DF for ; Fri, 9 Oct 2020 14:56:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7FF26222BA for ; Fri, 9 Oct 2020 14:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602255389; bh=eKhV1B1C+0JAvCUA9Ri5lD4cOPJVxC2GFBQ3mLOVFPA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=TDnodvaxS8n4Aj0fS65Oxo6t2HgnkXuLaSjoqAZS+bRQXaCegF5BlVtZ4J2iiRtAV 20IYTIiQooNoPOIknZEwbeiJvQBM9Odu9wYgPAQ/QXaQAGM5uAqtfXb4LEDE0xGYv2 vszvOijNhlAlFmUpWJeq2slKmyK6fkY6VU9soM0k= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388870AbgJIO42 (ORCPT ); Fri, 9 Oct 2020 10:56:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:35054 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732056AbgJIO41 (ORCPT ); Fri, 9 Oct 2020 10:56:27 -0400 Received: from localhost (unknown [104.132.1.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 97FC122260; Fri, 9 Oct 2020 14:56:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602255386; bh=eKhV1B1C+0JAvCUA9Ri5lD4cOPJVxC2GFBQ3mLOVFPA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=n56KezxUl1rJ7CHEXfPMwgL4X6ePZDUWhgcmiOs//2BIJL4oQAh7jxuNZwUDv6HdH 9lCiovSff1YidnCdP6rrwQr2kzstUh5SzAcEza5mHyjVhZrHDeKkgFJZVwQmf1C+/G Zqo8nFK5vq4RYg08vD8jwEoZ8wHpIB3v7TeRp7uk= Date: Fri, 9 Oct 2020 07:56:26 -0700 From: jaegeuk@kernel.org To: Chao Yu Cc: Eric Biggers , , , , Subject: Re: [f2fs-dev] [f2fs bug] infinite loop in f2fs_get_meta_page_nofail() Message-ID: <20201009145626.GA2186792@google.com> References: <000000000000432c5405b1113296@google.com> <20201007213253.GD1530638@gmail.com> <20201007215305.GA714500@google.com> <20201009015015.GA1931838@google.com> <8fa4f9fe-5ca5-f3a3-c8f4-e800373c1e46@huawei.com> <20201009043237.GB1973455@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/09, Chao Yu wrote: > On 2020/10/9 12:32, jaegeuk@kernel.org wrote: > > On 10/09, Chao Yu wrote: > > > On 2020/10/9 9:50, jaegeuk@kernel.org wrote: > > > > On 10/09, Chao Yu wrote: > > > > > On 2020/10/8 5:53, jaegeuk@kernel.org wrote: > > > > > > On 10/07, Eric Biggers wrote: > > > > > > > [moved linux-fsdevel to Bcc] > > > > > > > > > > > > > > On Wed, Oct 07, 2020 at 02:18:19AM -0700, syzbot wrote: > > > > > > > > Hello, > > > > > > > > > > > > > > > > syzbot found the following issue on: > > > > > > > > > > > > > > > > HEAD commit: a804ab08 Add linux-next specific files for 20201006 > > > > > > > > git tree: linux-next > > > > > > > > console output: https://syzkaller.appspot.com/x/log.txt?x=17fe30bf900000 > > > > > > > > kernel config: https://syzkaller.appspot.com/x/.config?x=26c1b4cc4a62ccb > > > > > > > > dashboard link: https://syzkaller.appspot.com/bug?extid=ee250ac8137be41d7b13 > > > > > > > > compiler: gcc (GCC) 10.1.0-syz 20200507 > > > > > > > > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1336413b900000 > > > > > > > > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12f7392b900000 > > > > > > > > > > > > > > > > The issue was bisected to: > > > > > > > > > > > > > > > > commit eede846af512572b1f30b34f9889d7df64c017d4 > > > > > > > > Author: Jaegeuk Kim > > > > > > > > Date: Fri Oct 2 21:17:35 2020 +0000 > > > > > > > > > > > > > > > > f2fs: f2fs_get_meta_page_nofail should not be failed > > > > > > > > > > > > > > > > > > > > > > Jaegeuk, it looks like the loop you added in the above commit doesn't terminate > > > > > > > if the requested page is beyond the end of the device. > > > > > > > > > > > > Yes, that will go infinite loop. Otherwise, it will trigger a panic during > > > > > > the device reboot. Let me think how to avoid that before trying to get the > > > > > > wrong lba access. > > > > > > > > > > Delivering f2fs_get_sum_page()'s return value needs a lot of codes change, I think > > > > > we can just zeroing sum_page in error case, as we have already shutdown f2fs via > > > > > calling f2fs_stop_checkpoint(), then f2fs_cp_error() will stop all updates to > > > > > filesystem data including summary pages. > > > > > > > > That sounds like one solution tho, I'm afraid of getting another panic by > > > > wrong zero'ed summary page. > > > > > > What case do you mean? maybe I missed some corner cases? > > > > I sent v2 to fix syzbot issue, which fixes wrong use of > > f2fs_get_meta_page_nofail. > > I agreed to fix that case, however we may encounter deadloop in other > places where we call f2fs_get_meta_page_nofail()? like the case that > filesystem will always see EIO after we shutdown device via dmflakey? We may need another option to deal with this. At least, however, it's literally _nofail function which should guarantee no error, instead of hiding the error with zero'ed page. > > Thanks, > > > > > > > > > Thanks, > > > > > > > > > > > > > > > > > Thoughts? > > > > > > > > > > Thanks, > > > > > > > > > > > > > > > > > > > > > > > > > - Eric > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Linux-f2fs-devel mailing list > > > > > > Linux-f2fs-devel@lists.sourceforge.net > > > > > > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel > > > > > > . > > > > > > > > > > . > > > > > > . > >