Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1714790ybh; Tue, 14 Jul 2020 05:34:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkwvR1Xm4S6S9vYHfQi9yrKkagBNpoVmGvP2xgAWRWKT8+2mseF85jwh/7SyOUIAUPyjAc X-Received: by 2002:a17:906:3889:: with SMTP id q9mr4582146ejd.318.1594730083075; Tue, 14 Jul 2020 05:34:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594730083; cv=none; d=google.com; s=arc-20160816; b=FFxGsJHV6zUdD/k9NX4uoM74l9OjSyfkM2CEet3I7mtJIysVMmDeznnEWRuISpiC8s yFsDV1zxiuROc4Y6Yc3Dc9v6S+tVfhGKrFwf3wFQvYB5dSq92n38N1vmAOKDwf5QuH9L enKNnKlfWzayx6qU4ycVfvvjL6dVDDzbkfsuwvMZSRQHB5YEXKzWJFDl7yryUJNBsRBw bRt8qMtJeYDCP87pgQqPGVB6LaTQ71XLDzZhN9F16ovnRpGggPtCVd5DxX1SkXCn7kdj f0CDC3RGWiBjPt/rVOH6b6+TG/MXpNroUVIGIvFbCqfZejgrBD3IQhu/sYfbw36CwB1c +uPg== 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=pzhizlqRKf9UWYN9fzpW1aGdqXnTnGVMwhttffaq6QE=; b=qb3Ue8OG4/4RYdvKWRg9ixKn3+dYfpp8xk89GPlRV6QECHJ8S3F90fJUokJTEOCz6M TXgo1I7SAvzsROHwSPWQPVz6TYYcHzKMC0q2RCd/bno2aap2A1cb4r6DMgjD7ktyuZZL lyKb3LTnJ1IZjCVrSC2ggL3vNSUCHvobpgvsZncIsgTloJ+d/ulKRVM/NlMRmwam7M2n 4RLg1WaDOVKezqmKD9rxQOFMRmWMU0GiqQUo9nOB7pWSsDENPo7d2pOJuNEL5lXD1QG4 SOr/Xg9FA6tpuQ59EZ4uNGdKwa+zp5gYToY0CovYOrGbYByAYcwDVaQxKqJcD8bJnJin OhcA== 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 c25si11034332edv.335.2020.07.14.05.34.07; Tue, 14 Jul 2020 05:34:43 -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 S1728197AbgGNMbY (ORCPT + 99 others); Tue, 14 Jul 2020 08:31:24 -0400 Received: from mx2.suse.de ([195.135.220.15]:47640 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728193AbgGNMbX (ORCPT ); Tue, 14 Jul 2020 08:31:23 -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 362BFAD85; Tue, 14 Jul 2020 12:31:25 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 66B541E12C9; Tue, 14 Jul 2020 14:31:22 +0200 (CEST) Date: Tue, 14 Jul 2020 14:31:22 +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: <20200714123122.GG23073@quack2.suse.cz> References: <20200713125818.21918-1-jack@suse.cz> <20200713134448.4CFA3A4051@d06av23.portsmouth.uk.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200713134448.4CFA3A4051@d06av23.portsmouth.uk.ibm.com> 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 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. > Maybe a background over the issue which you saw may help. > Also how did it recover out of it? e2fsck I suppose :) > Do you think it make sense to still emit a WARN_ON() here and then > return which warns that this could possibly a corrupted extent > entry? (maybe WARN_ON_ONCE() or via some ratelimiting if multiple extent > entries are corrupted for that inode). No, WARN is definitely wrong in this case. We could call ext4_error() if we wanted. That would make sence although I've decided not to add it to the original Wolfgang's fix since this is more like a failing readahead. But OTOH it's metadata corruption that's unlikely to go away so I can be easily convinced to put ext4_error() there :). Honza -- Jan Kara SUSE Labs, CR