Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2316615ybz; Sat, 18 Apr 2020 21:55:02 -0700 (PDT) X-Google-Smtp-Source: APiQypIAb7O3F9qzIHn66WxoFJCi9/5u6KxCR2EVgn/6q12W1cuH+df9IdDVMsK7Lmm2VF3G5+Jx X-Received: by 2002:a05:6402:1422:: with SMTP id c2mr3392528edx.179.1587272102748; Sat, 18 Apr 2020 21:55:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587272102; cv=none; d=google.com; s=arc-20160816; b=xwrbstBpvMDYL15qxcjkGqkqvzr0jQpaqqTDimHejUBdluR1Shi1DWCyoMOMaLGUqj UsM+pqpKJI1qJb6U+lGTbTwY0l4oG5gCPSAUmNgerBIwmzK1jvV8FZPFn8L6UB3AmeBz WzI+j/p3wCm39Yol1TzJgxWbiDD86+wjjnw6gHRDKwKcMcsshew4Er32IcBgolKBEXBk qOGKgjaotFYR6onaMnZGFaN3csM1+zgWDWkE7XX3z7OYlExVBRhyXkNXA6NZkyiaUXQc 0mF+KX9yM13Srchgogie8hgL9I9OtIGeOzXe6nQazFVnbrsUYlre3SNl/+zizjM8sfsz dQxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=tescvqWD8UDgg+FKYCMkswFgz0VfRDmgwIFlJI10ZiE=; b=o1i+uLzRCuSX/ZjZCGG1qsnsHnpyhOdO2vNG0v5TqGJhVSxUtrN7HU9ExqQ7meoNQX y53oT8a+5ITFXWLlE8O5u5v0j7WrtTnefv+2saV2uZg/Hk5spKTGxeYAJeUACuERPYIx LRoKMpF86b1rI156Po7Oy+wWvPe+ZXJH97ZMv8/FQCb8r9cF9QZMMp9MKNDTZQJDQkKJ 4pVFdsk0HFEy0gEH2JuczO3uTWSfHbeTV3Zs5j6M+3xwCVZAHnpGd/5MAV7H8vm1WMeH 1Zqy9uu0SdTkCAu6Vb6szC1xooNbJzTeHUDEld02IbT08O1F47QmcpKNJSFIBG3qJHwp ukdw== 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 a16si7783567ejt.100.2020.04.18.21.54.14; Sat, 18 Apr 2020 21:55:02 -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 S1725914AbgDSEma (ORCPT + 99 others); Sun, 19 Apr 2020 00:42:30 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:40341 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725763AbgDSEma (ORCPT ); Sun, 19 Apr 2020 00:42:30 -0400 Received: from callcc.thunk.org (pool-100-0-195-244.bstnma.fios.verizon.net [100.0.195.244]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 03J4gO9Z020836 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 19 Apr 2020 00:42:25 -0400 Received: by callcc.thunk.org (Postfix, from userid 15806) id A630242013B; Sun, 19 Apr 2020 00:42:24 -0400 (EDT) Date: Sun, 19 Apr 2020 00:42:24 -0400 From: "Theodore Y. Ts'o" To: Ritesh Harjani Cc: Murphy Zhou , Ext4 Developers List Subject: Re: [PATCH] ext4: validate fiemap iomap begin offset and length value Message-ID: <20200419044224.GA311394@mit.edu> References: <20200418233231.z767yvfiupy7hwgp@xzhoux.usersys.redhat.com> <20200419015654.F2061A4051@d06av23.portsmouth.uk.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200419015654.F2061A4051@d06av23.portsmouth.uk.ibm.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Sun, Apr 19, 2020 at 07:26:53AM +0530, Ritesh Harjani wrote: > ++ mailing list. > Sorry somehow it got dropped. > > > On 4/19/20 7:21 AM, Ritesh Harjani wrote: > > Hello Murphy, > > > > I guess the patch to fix this issue was recently submitted. > > Could you please test your reproducer, xfstest and ltp > > tests on below patch too. And let me know if we can add your Tested-by: > > > > https://patchwork.ozlabs.org/project/linux-ext4/patch/1a2dc8f198e1225ddd40833de76b60c7ee20d22d.1587024137.git.riteshh@linux.ibm.com/ His reproducer is still failing with your patch. In order to for his reproducer to succeed, we need to constrain lblk and last_lblk more strictly than what is done in: [PATCHv2 1/1] ext4: fix overflow case for map.m_len in ext4_iomap_begin_* His patch does fix the issue. ext4_map_block() is returning EFSCORRUPTED when lblk is EXT4_MAX_LOGICAL_BLOCK, which is why he's constraining lblk to EXT4_MAX_LOGICAL_BLOCK. I haven't looked into this more closely yet, but it looks we have some overflow/wraparound issue when lblk is 0xFFFFFFFF. Which might mean that in fact EXT4_MAX_LOGICAL_BLOCK might need to be 0xFFFFFFFE, or we need to look very closely our code paths to make sure the right thing happes when we call ext4_map_blocks() with m_lblk == 0xFFFFFFFF and m_len == 1. I think we need to take his patch, and make a simialr change to ext4_iomap_begin(). Ritesh, do you agree? - Ted