Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1039499ybl; Sat, 17 Aug 2019 17:07:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyh8rtvZ1ZQKdSG6+f7hLSXXddPIwFLajS4qNVvrDw+60TFGn9WNWokou0xZ+5uGKUeCj+7 X-Received: by 2002:a17:902:848c:: with SMTP id c12mr13918387plo.47.1566086868042; Sat, 17 Aug 2019 17:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566086868; cv=none; d=google.com; s=arc-20160816; b=VDUjgqovMFM84+SnBhrdolzaQtjc2jGvM8IUkuCrCF0U9APGLvBmQVyx6NX66TRx/F PHqcx21t7K5TBs+sr2A5dLcU/GwbiridAhehjVaVmfywXohbmM1o8RR3KRX36ompPbd6 ZkYlx9Q0lPRi/a3O+cRTAQyvtN+E8KiFMvAhSRBp61OafIZ1KGV412L53IXUsWiD3orI RkQiYE4Yv8FGdXXiEJMsW4Hz5bFBDj+xcRJXBBxdCLV1Dsc72w2SGPQ38FN0CsNJwhMR oW/SGfY0oAjTSvjD0WqvbaXRGZ2ubvAMKJzZhkuBO+97esdUIBS6MKJt9CtSbj0Dg239 T/qw== 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:dkim-signature; bh=GjexilErYddzHprQKMeXPkQTQHS1qRZ0SITxO8/HqxI=; b=jqOMzhJkVOgSxjxHYHb6Xkl0L5nLZ3UC6Zo1GGY8Sua9M1QJcleoSMV2YNQ6U+Ow0k S32wY3sgkNZnksplgseOeFyUBjkyZ6thcRNncb2mwZ8Ncnhdq/cN1JkF9wKEHnHYUVET 8vS3GMiPlLVSOZ5S2kT5rfaXiwmd6OERmJKchVgMK7UXoLAZcvrf9IfKRg49nhqImPNa GUOF/2MISJkBOKcbpWUhmfkYvURzMDH8VDb3u3jmMCAo8ezdPTSORwqHnUusD6XcB5k6 o8lwppHHgkwBY8BnzAEEuH8dUm6DPmuy894Y/yUpeAoW9ySvG90l48fxdWTuONw/SAP5 QDLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aol.com header.s=a2048 header.b=iwBc9fLb; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=aol.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j38si6836022plb.107.2019.08.17.17.06.57; Sat, 17 Aug 2019 17:07:48 -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=@aol.com header.s=a2048 header.b=iwBc9fLb; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=aol.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726302AbfHRAEY (ORCPT + 99 others); Sat, 17 Aug 2019 20:04:24 -0400 Received: from sonic317-21.consmr.mail.gq1.yahoo.com ([98.137.66.147]:38206 "EHLO sonic317-21.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726198AbfHRAEY (ORCPT ); Sat, 17 Aug 2019 20:04:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1566086663; bh=GjexilErYddzHprQKMeXPkQTQHS1qRZ0SITxO8/HqxI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject; b=iwBc9fLbgv3aKJuDeNhV1Ke47I5/wMOsEKYCb9/gBrknOeKWKkpZA8edhaI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IctemOpp1d65EkcF5LqD4qGwAGPWbZbTXbjqt.4cF 4LYBKNvgX._lWg2q1OW80m8CKwAQKjod0A6ZUL_gsigI_TpQeoVsF9RVgM2viUXYic46xTku.W3T f6NVrNacE6BEkZQIFy6lsy_YXxB5wGBXMQHBVF909yNiMWhH2_gpOCj465tqSoC_nkAxFDIXOhDO WYbMBdYm1LxDRSK8y26hvfX7_1bwbTGIXlCMANAOWExjQLKTOIFixsaniXVCRSMItTa7OqM5Cjbl Dx.Roops.FoV039YkLMrg2KTIspSxLNHTZz9qj66QWqiavhl900wU0DDVnvx.5lgWj1u6S4dY_3c KoYzhzPAdiarBMxjrl308WNEai2VrDlXKSHw066yRw8yxpEAaMtbyt6F1Z2nqq9bLxIH0lf3ILAC HXMrKFe8fSOezb5kwvp42UZ54p5cotj9FLGIuf7a8wCmImseLDhRAdTLe25PFW0oJQnKXdkrKP65 nQES9QGEWn3JdgQ5M61p.kOwNShzopBm.3Q-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.gq1.yahoo.com with HTTP; Sun, 18 Aug 2019 00:04:23 +0000 Received: by smtp401.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID ad9a5bfd260b834e47c5b315d99fbfcd; Sun, 18 Aug 2019 00:04:21 +0000 (UTC) Date: Sun, 18 Aug 2019 08:04:12 +0800 From: Gao Xiang To: Richard Weinberger Cc: Greg Kroah-Hartman , Al Viro , linux-fsdevel , devel , linux-erofs , linux-kernel , Andrew Morton , Stephen Rothwell , tytso , Pavel Machek , David Sterba , Amir Goldstein , Christoph Hellwig , Darrick , Dave Chinner , Jaegeuk Kim , Jan Kara , torvalds , Chao Yu , Miao Xie , Li Guifu , Fang Wei , Gao Xiang Subject: Re: [PATCH] erofs: move erofs out of staging Message-ID: <20190818000408.GA20778@hsiangkao-HP-ZHAN-66-Pro-G1> References: <20190817082313.21040-1-hsiangkao@aol.com> <1746679415.68815.1566076790942.JavaMail.zimbra@nod.at> <20190817220706.GA11443@hsiangkao-HP-ZHAN-66-Pro-G1> <1163995781.68824.1566084358245.JavaMail.zimbra@nod.at> <20190817233843.GA16991@hsiangkao-HP-ZHAN-66-Pro-G1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190817233843.GA16991@hsiangkao-HP-ZHAN-66-Pro-G1> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 18, 2019 at 07:38:47AM +0800, Gao Xiang wrote: > Hi Richard, > > On Sun, Aug 18, 2019 at 01:25:58AM +0200, Richard Weinberger wrote: [] > > > > While digging a little into the code I noticed that you have very few > > checks of the on-disk data. > > For example ->u.i_blkaddr. I gave it a try and created a > > malformed filesystem where u.i_blkaddr is 0xdeadbeef, it causes the kernel > > to loop forever around erofs_read_raw_page(). > > I don't fuzz all the on-disk fields for EROFS, I will do later.. > You can see many in-kernel filesystems are still hardening the related > stuff. Anyway, I will dig into this field you mentioned recently, but > I think it can be fixed easily later. ...I take a simple try with the following erofs-utils diff and a directory containing enwik9 only, with the latest kernel (5.3-rc) and command line is mkfs/mkfs.erofs -d9 enwik9.img testdir. diff --git a/lib/inode.c b/lib/inode.c index 581f263..2540338 100644 --- a/lib/inode.c +++ b/lib/inode.c @@ -388,8 +388,7 @@ static bool erofs_bh_flush_write_inode(struct erofs_buffer_head *bh) v1.i_u.compressed_blocks = cpu_to_le32(inode->u.i_blocks); else - v1.i_u.raw_blkaddr = - cpu_to_le32(inode->u.i_blkaddr); + v1.i_u.raw_blkaddr = 0xdeadbeef; break; } I tested the corrupted image with looped device and real blockdevice by dd, and it seems fine.... [36283.012381] erofs: initializing erofs 1.0 [36283.012510] erofs: successfully to initialize erofs [36283.012975] erofs: read_super, device -> /dev/loop17 [36283.012976] erofs: options -> (null) [36283.012983] erofs: root inode @ nid 36 [36283.012995] erofs: mounted on /dev/loop17 with opts: (null). [36297.354090] attempt to access beyond end of device [36297.354098] loop17: rw=0, want=29887428984, limit=1953128 [36297.354107] attempt to access beyond end of device [36297.354109] loop17: rw=0, want=29887428480, limit=1953128 [36301.827234] attempt to access beyond end of device [36301.827243] loop17: rw=0, want=29887428480, limit=1953128 [36371.426889] erofs: unmounted for /dev/loop17 [36518.156114] erofs: read_super, device -> /dev/nvme0n1p4 [36518.156115] erofs: options -> (null) [36518.156260] erofs: root inode @ nid 36 [36518.156384] erofs: mounted on /dev/nvme0n1p4 with opts: (null). [36522.818884] attempt to access beyond end of device [36522.818889] nvme0n1p4: rw=0, want=29887428984, limit=62781440 [36522.818895] attempt to access beyond end of device [36522.818896] nvme0n1p4: rw=0, want=29887428480, limit=62781440 [36524.072018] attempt to access beyond end of device [36524.072028] nvme0n1p4: rw=0, want=29887428480, limit=62781440 Could you give me more hints how to reproduce that? and I will dig into more maybe it needs more conditions... Thanks, Gao Xiang > > Thanks, > Gao Xiang > > > > > Thanks, > > //richard