Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp410768ybh; Wed, 15 Jul 2020 05:25:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqx0a6BbayINYlhS1YuHftzvsg7313+1WK66RKs6Z7a8ESQezzxcYDtNB2jFwSiY6Fnsze X-Received: by 2002:a50:e617:: with SMTP id y23mr7822192edm.47.1594815912250; Wed, 15 Jul 2020 05:25:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594815912; cv=none; d=google.com; s=arc-20160816; b=c+BhZzkC/a3Em0g26AzZYTHRhWvYC60vdp8HohjIw69URxcv9vls8DEekq5NN414Fw 00hiYJg3m3oLXRJCS0K4XZ+eMqByyGK66HhIU2/5g8Ti2OXHcDuXwW4CBVCGiT42siik jbQGl830v7QvsphkdkixAbSnLmKGSMLx/CJUwCWJs8Mc6ReOL9Klpci/On78CLbHAA9D wCwYdQyyD1H6U5Zkt5+aHRJf0qQbUqWeZznogJMavzahSPnBnDPFNRNhTVkwGabFi4AZ PodtFnsGBAwNb2tL+gS67wAN/63DMGyrY1517ham6WP/gba6DlwOJEIlYtk2eImOrysw 2fVQ== 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; bh=mIRl+z4OkAlXF9yiEgk2RFbXRYSCxoLcQXiEIX6aV9A=; b=jR5ZWaixjx1NCHppZPHto/qVDjueYww8rTh/ZWGy+dJsensp4zybEUXlwHzWE66A4T cBDQJ5J5AFJnMwBG6GX9DxUMuM2LKcJP6fWQdPFoNrGAMsZI/pR9p+Ej68rhYi9eeNLi bbu308UdfGJ+ppqjmOUc5gmWKoTe29lURTkxf/symMSHBN75OoFQnNucnwUrxO7IWJBv b2TWDBUzPWEWHIR0qapBR7DMrtgcc/loZFzDNa7WpxnnMtLuk4Y1UkkemeLxTheXjGuD IVjoxnHAw0MwXE8YT5EIXG25x1Jf2IkfMIrBEJzwfS0T3RRcWhDWyQgjXl2ZbLqYi79Z pniw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v16si1181163edr.93.2020.07.15.05.24.40; Wed, 15 Jul 2020 05:25:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730508AbgGOLxO (ORCPT + 99 others); Wed, 15 Jul 2020 07:53:14 -0400 Received: from [195.135.220.15] ([195.135.220.15]:51784 "EHLO mx2.suse.de" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1730506AbgGOLxO (ORCPT ); Wed, 15 Jul 2020 07:53:14 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1B9A7B1B4; Wed, 15 Jul 2020 11:53:16 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id AFCB51E12C9; Wed, 15 Jul 2020 13:53:12 +0200 (CEST) Date: Wed, 15 Jul 2020 13:53:12 +0200 From: Jan Kara To: Ritesh Harjani Cc: Jan Kara , Ted Tso , linux-ext4@vger.kernel.org, Wolfgang Frisch Subject: Re: [PATCH] ext4: catch integer overflow in ext4_cache_extents Message-ID: <20200715115312.GL23073@quack2.suse.cz> References: <20200713125818.21918-1-jack@suse.cz> <20200713134448.4CFA3A4051@d06av23.portsmouth.uk.ibm.com> <20200714123122.GG23073@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200714123122.GG23073@quack2.suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue 14-07-20 14:31:22, Jan Kara wrote: > On Mon 13-07-20 19:14:47, Ritesh Harjani wrote: > > > > > > On 7/13/20 6:28 PM, Jan Kara wrote: > > > From: Wolfgang Frisch > > > > > > When extent tree is corrupted we can hit BUG_ON in > > > ext4_es_cache_extent(). Check for this and abort caching instead of > > > crashing the machine. > > > > Was it intentionally made corrupted by crafting a corrupted disk image? > > I'm not sure how Wolfgang hit the issue. I'd expect some fs image > fuzzing... Wolfgang? > > > Are there more such logic in place which checks for such corruption at other > > places? > > That's a good question. But now that I'm looking at it ext4_ext_check() > should actually catch a corruption like this. It is only the path in > ext4_find_extent()->ext4_cache_extents() that can face the issue so > probably instead of a fix in ext4_cache_extents() we should rather add more > careful extent info checks for the extents contained directly in the inode. > I'll look into it. I was checking this more and indeed the problem can actually happen only with the journal inode because that is special-cased when checking extent tree. I'll send a new series that fixes this in a cleaner way. Honza -- Jan Kara SUSE Labs, CR