Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3816502ybb; Mon, 23 Mar 2020 08:13:13 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtSATYAolWyiDMuYU/CL7VCiYVRLrIMrKdHRHCy0bOCHeiX9ykyyD2A0RXPFe+ms0DhIQSR X-Received: by 2002:aca:ddc4:: with SMTP id u187mr17849304oig.129.1584976393612; Mon, 23 Mar 2020 08:13:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584976393; cv=none; d=google.com; s=arc-20160816; b=QhdKQktAdi7PpGW9z+ghfnqB849QTWSp/1SfZRsZVVO8K7oPn75GKNRr2zTykrQXGP LCk2yrX5o2pMV2xp6ZuUdxd9mxpvR8T23yoJVgpP7UkyaUjYn1gd6svJXTbkDRH6LmmU 3oefPsvbGhQKOMeyvxbRYwvhrhw3c1+bB0oUZigPxEWNodF4w6wCXxa7iQilxZ54FtX0 YGkgpJGf3ihjr9pyvTJdubqiRp6gDJQG8A403eY38iapKMDTWB1XX1XD/6YDMB9h15FX YVKUV+5sU7cG+EzNNv3OOkM1TUwNSqJIplJHECFqSC0qeO7vCRSECm5KUUy3OgEDaL6W BYpw== 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=0AoPx3M//CC4MKv+fqKfXM7iuK3yRsz/4Eiic0tSJ0Y=; b=CX/TK92MUmSVkqA/BgIgKsKkuLVrNrDb1TSXkW6uvM9/paii/+K4S1hYDJP0MbfN57 zcwnX1BX/VyK5r3NLc0XWZbhIFPorA9DL6Sp6qL01kBjLnm0LfTjWFez0z/dpbeMFVme nCPFSN/Wu45CfpDkRbBF5GWEkNO+GfMkKO38kuT2NkbMKLPFT6fh9JBOX5k5Bf9HkwgV ZZg2HGHGEDkNXtkwdGa7rukp76BSBdiNTT8416IuGO2hyc72FnyYFZMI47KbPYgHRTmN F9gtKq4fib9s06NaAWMQZFasD6GR6ZVtoIzo/LsCBXSibrflaQTsLnmqJxfb34jF2ef1 l+xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fp35Xy2S; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j69si7501401oib.93.2020.03.23.08.12.37; Mon, 23 Mar 2020 08:13:13 -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=@kernel.org header.s=default header.b=fp35Xy2S; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727226AbgCWPK2 (ORCPT + 99 others); Mon, 23 Mar 2020 11:10:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:32926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727064AbgCWPK2 (ORCPT ); Mon, 23 Mar 2020 11:10:28 -0400 Received: from localhost (unknown [104.132.1.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 89130206F8; Mon, 23 Mar 2020 15:10:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584976227; bh=DEot+U5aAhQnERI+yODgTb0Q/N9eQ71HwwOhlgIpZNg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fp35Xy2S29GLP/ffijwK4fWsN+7zW24b/sRU3E5KJRjWgG2NDU9PL5qcUH5rARgsq U/XhqJhFFnjVPTVydoGD1OUz86UQbWzlEmA/IJXfp1RWhT6z5RLNP6inFn/hEAWGja x4PkJp+QG2cQ6qnZ7pz53hrZcikOl+4Q50CiCUls= Date: Mon, 23 Mar 2020 08:10:27 -0700 From: Jaegeuk Kim To: Joe Perches Cc: Chao Yu , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, chao@kernel.org Subject: Re: [PATCH v5] f2fs: fix potential .flags overflow on 32bit architecture Message-ID: <20200323151027.GA123526@google.com> References: <20200323031807.94473-1-yuchao0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/23, Joe Perches wrote: > On Mon, 2020-03-23 at 11:18 +0800, Chao Yu wrote: > > f2fs_inode_info.flags is unsigned long variable, it has 32 bits > > in 32bit architecture, since we introduced FI_MMAP_FILE flag > > when we support data compression, we may access memory cross > > the border of .flags field, corrupting .i_sem field, result in > > below deadlock. > [] > > diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c > [] > > @@ -362,7 +362,7 @@ static int do_read_inode(struct inode *inode) > > fi->i_flags = le32_to_cpu(ri->i_flags); > > if (S_ISREG(inode->i_mode)) > > fi->i_flags &= ~F2FS_PROJINHERIT_FL; > > - fi->flags = 0; > > + bitmap_zero(fi->flags, BITS_TO_LONGS(FI_MAX)); > > Sorry, I misled you here, this should be > > bitmap_zero(fi->flags, FI_MAX); Thanks, I applied this directly in the f2fs tree.