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=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 5A366C83007 for ; Tue, 28 Apr 2020 07:47:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A2D0206A5 for ; Tue, 28 Apr 2020 07:47:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="rzZ7dWmY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726396AbgD1HrT (ORCPT ); Tue, 28 Apr 2020 03:47:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726369AbgD1HrT (ORCPT ); Tue, 28 Apr 2020 03:47:19 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 156CBC03C1A9; Tue, 28 Apr 2020 00:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=XqbZray/izI+DtrCZeQqScd+zG1eR8dDs357djsfCWI=; b=rzZ7dWmYdkxfunsUxfkxv/fh5g m6ldEYaWz6UCIpI8/bFvtB5yw82lrHnY1Hb6XCELINXMcsjN3oRwF8e+Xz1q1euYOOySS45KZsYfh b4WGefXAB5V6TN8vGK8Y3FXiUkQkSRPOq29fEVH0yQ3+TcBoO/PaxJjiqOHVXlCcy0wOwZQce8lAC ZG3B0UOXwRK542Kt9GwWMHogmveURyNb3D5r6NFGx0l0vwU2TJkQ/aanW++yi8+vD/f/xQcqed3Cm O0imsixLSHCWqkYtwyFFBv7q45RxeHIkh8OaWBSd8dGQNpHd0yBXn+1KRWxDj+NSLUmEmaWZdVOj9 ANHmZgLQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jTKxV-0003KI-8Y; Tue, 28 Apr 2020 07:47:13 +0000 Date: Tue, 28 Apr 2020 00:47:13 -0700 From: Christoph Hellwig To: Ritesh Harjani Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, Alexander Viro , "Darrick J . Wong" , Christoph Hellwig , Jan Kara , tytso@mit.edu, "Aneesh Kumar K . V" , linux-ext4@vger.kernel.org, Jan Kara , Christoph Hellwig Subject: Re: [PATCHv2] fibmap: Warn and return an error in case of block > INT_MAX Message-ID: <20200428074713.GA12180@infradead.org> References: <58f0c64a3f2dbd363fb93371435f6bcaeeb7abe4.1588058868.git.riteshh@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <58f0c64a3f2dbd363fb93371435f6bcaeeb7abe4.1588058868.git.riteshh@linux.ibm.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org On Tue, Apr 28, 2020 at 01:08:31PM +0530, Ritesh Harjani wrote: > We better warn the fibmap user and not return a truncated and therefore > an incorrect block map address if the bmap() returned block address > is greater than INT_MAX (since user supplied integer pointer). > > It's better to pr_warn() all user of ioctl_fibmap() and return a proper > error code rather than silently letting a FS corruption happen if the > user tries to fiddle around with the returned block map address. > > We fix this by returning an error code of -ERANGE and returning 0 as the > block mapping address in case if it is > INT_MAX. > > Now iomap_bmap() could be called from either of these two paths. > Either when a user is calling an ioctl_fibmap() interface to get > the block mapping address or by some filesystem via use of bmap() > internal kernel API. > bmap() kernel API is well equipped with handling of u64 addresses. > > WARN condition in iomap_bmap_actor() was mainly added to warn all > the fibmap users. But now that we have directly added this warning > for all fibmap users and also made sure to return 0 as block map address > in case if addr > INT_MAX. > So we can now remove this logic from iomap_bmap_actor(). > > Reviewed-by: Jan Kara > Reviewed-by: Christoph Hellwig Well, this changed quite a bit from the previous version, so I would have dropped the Reviewed-by tags. That being said this version still looks good to me: Reviewed-by: Christoph Hellwig