Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2098734pxu; Fri, 9 Oct 2020 07:58:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHLd/k66pqwb3p2EPSCWX9mJA3xOiTOCT+rfY6q0f3IcXRgdVkrdkEIWJ51o6eSJBE7zP2 X-Received: by 2002:a50:e40b:: with SMTP id d11mr15024653edm.198.1602255482462; Fri, 09 Oct 2020 07:58:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602255482; cv=none; d=google.com; s=arc-20160816; b=WnrteFqZWpw5QP+TWK/6fHtXqqxY1iAnYbbaaL9armkJ7OTqSjaFTztg6EqjB1Q7Qg UFVJtvYYxhXx6WfyB1DVOxmk2lTZFSCu7sRJd6N7/SpcPmlGg5gVrjx0ERHz8ZmpAgC4 l7ZpIkBiEQMDArK+YY+chMO9Z4mluB382ilLPZqV3+IOXP+BG1g0fhoe2Zrkq11d6OYe 3idIv1ODL9JFOYJRBAThRGmRqIX5z7Grl7ct07unWDUECvCe5sgoHaQyxZtqKPcH3esg ZVPDnVru0Lmq4YWM0CSrmvlllpAZZjrskNaZchzXwEphs3PtQqX43BlPnmz78jGBua5M xdnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ptkaw3vE3vJbkFBAZ4P40zC0MxU8bFP8Z8CUWmRXk6Y=; b=AaiRuz7G6XPn8lrdaJSjyj/XuE/lxEpQSqmTtdPqby5YLvMODc+8TjffujVYZ9kwTP TYAUgFkbgNTRtpBFXV9DKr8QWvIlGW9abPXi+L5c3TzTYe87snXLtCWgnqexYPJQ/XB8 Nn5jcv8Qb1l1Ro6NkI650/6Qewjd3Hm6eWIwDaxLdxBjo8SG5COMB4+WhT9azf5GnhKB 7HBRXI3KloHMXtWt84R2EjdalvMOLgny4sXWjUotQMz2HgpBi+WhzUr9CSPIRG5Q5pCx O2/9FApC7giJ7YzX6M4JuDlnzxB+2E+7U4nTZlxGNqjjsI5kHutDDcaHf00R7rPRhfil CcWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n56KezxU; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n23si2082006eje.334.2020.10.09.07.57.38; Fri, 09 Oct 2020 07:58:02 -0700 (PDT) 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=@kernel.org header.s=default header.b=n56KezxU; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388780AbgJIO41 (ORCPT + 99 others); Fri, 9 Oct 2020 10:56:27 -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 > > > > > > . > > > > > > > > > > . > > > > > > . > >