From mboxrd@z Thu Jan 1 00:00:00 1970 From: chao@kernel.org (Chao Yu) Date: Mon, 19 Aug 2019 22:50:18 +0800 Subject: [PATCH 4/6] staging: erofs: avoid loop in submit chains In-Reply-To: <20190819103426.87579-5-gaoxiang25@huawei.com> References: <20190819080218.GA42231@138> <20190819103426.87579-1-gaoxiang25@huawei.com> <20190819103426.87579-5-gaoxiang25@huawei.com> Message-ID: <24eacd62-3da1-e6cf-8166-43049dbedcf2@kernel.org> On 2019-8-19 18:34, Gao Xiang wrote: > As reported by erofs-utils fuzzer, 2 conditions > can happen in corrupted images, which can cause > unexpected behaviors. > - access the same pcluster one more time; > - access the tail end pcluster again, e.g. > _ access again (will trigger tail merging) > | > 1 2 3 1 2 -> 1 2 3 1 > |_ tail end of the chain \___/ (unexpected behavior) > Let's detect and avoid them now. > > Signed-off-by: Gao Xiang Reviewed-by: Chao Yu Thanks, 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=-5.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 1B836C3A5A0 for ; Mon, 19 Aug 2019 14:50:38 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 BDC9A2070D for ; Mon, 19 Aug 2019 14:50:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="szZD7vvv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BDC9A2070D 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-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46BxgH5QyfzDqVm for ; Tue, 20 Aug 2019 00:50:35 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=kernel.org (client-ip=198.145.29.99; helo=mail.kernel.org; envelope-from=chao@kernel.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="szZD7vvv"; dkim-atps=neutral Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46Bxg635k6zDq99 for ; Tue, 20 Aug 2019 00:50:25 +1000 (AEST) Received: from [192.168.0.101] (unknown [180.111.132.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2B2752070D; Mon, 19 Aug 2019 14:50:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566226223; bh=ymw3Kw+8cxX+oQfkPPvxyyrMYifjiGJnCyi5QOBej5E=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=szZD7vvv8SeH6gvjnceD6e8J8UL1NpP2W6v04Sz7qhA37WjawDfGvmZY+gMo01R9+ oPhpZN26USZIyWiUJN3WrHsFdMnUzGizZoZpc83Am1NlAd3drloEUoTMtxB1p+XFIO sA1sHKdk2WgxYnNbt1nmv69DiBDqTta99OlZE1GE= Subject: Re: [PATCH 4/6] staging: erofs: avoid loop in submit chains To: Gao Xiang , Chao Yu , Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-fsdevel@vger.kernel.org References: <20190819080218.GA42231@138> <20190819103426.87579-1-gaoxiang25@huawei.com> <20190819103426.87579-5-gaoxiang25@huawei.com> From: Chao Yu Message-ID: <24eacd62-3da1-e6cf-8166-43049dbedcf2@kernel.org> Date: Mon, 19 Aug 2019 22:50:18 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190819103426.87579-5-gaoxiang25@huawei.com> Content-Type: text/plain; charset="UTF-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Miao Xie , linux-erofs@lists.ozlabs.org, LKML , weidu.du@huawei.com Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" Message-ID: <20190819145018.fF0XuDz_NKGl9iEtdjAMI3OsZBfhVZkRLWa8my9RfmE@z> On 2019-8-19 18:34, Gao Xiang wrote: > As reported by erofs-utils fuzzer, 2 conditions > can happen in corrupted images, which can cause > unexpected behaviors. > - access the same pcluster one more time; > - access the tail end pcluster again, e.g. > _ access again (will trigger tail merging) > | > 1 2 3 1 2 -> 1 2 3 1 > |_ tail end of the chain \___/ (unexpected behavior) > Let's detect and avoid them now. > > Signed-off-by: Gao Xiang Reviewed-by: Chao Yu Thanks, 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=-5.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 C70DCC3A5A0 for ; Mon, 19 Aug 2019 14:50:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C1902082A for ; Mon, 19 Aug 2019 14:50:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566226228; bh=ymw3Kw+8cxX+oQfkPPvxyyrMYifjiGJnCyi5QOBej5E=; h=Subject:To:Cc:References:From:Date:In-Reply-To:List-ID:From; b=hTypL9yfHowO6Jw1uM9ng0ujT3pbKdEL/Eun1WhZ4NIAnf4hm+sU/joVu70sx1ttB 1Fz04Iqn3hepy7WQG+e4pEykSraReDHhOdYMUt9KraB5t8ZXWxMTHegWSxAy0IeR34 G9qYSNGjesY0V/jhthK5WTz5ZQvAta5W79SyYrDg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726784AbfHSOuY (ORCPT ); Mon, 19 Aug 2019 10:50:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:44532 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726168AbfHSOuY (ORCPT ); Mon, 19 Aug 2019 10:50:24 -0400 Received: from [192.168.0.101] (unknown [180.111.132.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2B2752070D; Mon, 19 Aug 2019 14:50:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566226223; bh=ymw3Kw+8cxX+oQfkPPvxyyrMYifjiGJnCyi5QOBej5E=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=szZD7vvv8SeH6gvjnceD6e8J8UL1NpP2W6v04Sz7qhA37WjawDfGvmZY+gMo01R9+ oPhpZN26USZIyWiUJN3WrHsFdMnUzGizZoZpc83Am1NlAd3drloEUoTMtxB1p+XFIO sA1sHKdk2WgxYnNbt1nmv69DiBDqTta99OlZE1GE= Subject: Re: [PATCH 4/6] staging: erofs: avoid loop in submit chains To: Gao Xiang , Chao Yu , Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-fsdevel@vger.kernel.org Cc: LKML , linux-erofs@lists.ozlabs.org, Miao Xie , weidu.du@huawei.com, Fang Wei References: <20190819080218.GA42231@138> <20190819103426.87579-1-gaoxiang25@huawei.com> <20190819103426.87579-5-gaoxiang25@huawei.com> From: Chao Yu Message-ID: <24eacd62-3da1-e6cf-8166-43049dbedcf2@kernel.org> Date: Mon, 19 Aug 2019 22:50:18 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190819103426.87579-5-gaoxiang25@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On 2019-8-19 18:34, Gao Xiang wrote: > As reported by erofs-utils fuzzer, 2 conditions > can happen in corrupted images, which can cause > unexpected behaviors. > - access the same pcluster one more time; > - access the tail end pcluster again, e.g. > _ access again (will trigger tail merging) > | > 1 2 3 1 2 -> 1 2 3 1 > |_ tail end of the chain \___/ (unexpected behavior) > Let's detect and avoid them now. > > Signed-off-by: Gao Xiang Reviewed-by: Chao Yu Thanks,