Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3872058ybl; Mon, 26 Aug 2019 01:45:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfhfvJjBZmoDfBS9rmZ0VofSiWx2sib107bFbbwjUIBUgoNI2oyi64m8mnpa0M7SNjupg5 X-Received: by 2002:a17:902:ac88:: with SMTP id h8mr16564976plr.77.1566809153149; Mon, 26 Aug 2019 01:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566809153; cv=none; d=google.com; s=arc-20160816; b=hVTUxPwGddBMbAPyhJKAspKU1SkHR99ipjWx0seMCU9F+uecqw2GVMXMIa+xU0N/Ph cGmC08aG39tvdCidZ3rZCgSmEK68TVg1aIgx9bKhcKVA0LmIIicZmhuY4lakMLU1xdkx JFh67BZcNqMuz8KXqQuozCcQx960/129BA8ISj0YfK35OK8FIq0blOxwFleWiG7vAylL IiplVjSZ3z9iBJIQWMkVF+WZBI6ZRsCiJWV41oQHppN1ONW4SUmUP9ZT3uiz9RKA+XWW Htal7wgcUHYRbbyfAbuUsL4n1JRtHNBoQWcxA1e9rmZS48wm5ufqho2+g91cqSFn5Ofn VWFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=YvfHB+MQE0aTGAliSOYXU3l5WtiQr4hWfEW9wtUmj1c=; b=xLqtuBdAPqjzcxXZ7TgoZrcx4/4lAXk5YZT+4cLOB3MbycXn6b8mEB7uT2UjXx5ldt LuPQSSmhI2BaC1t2jbHmzq6fqjddLF9Q6ZNrVknyngVdajRFJEl+XJQBZRLkwWpC3lST tDDla1Eo+P+gYdwiOenVr3Zk7nzqPYXvFEhHtIDSu7BO0s5cmblaBuKVbk4GfrHpFjh4 +mRH8a+ooRCaxzaneG3hDpkSCqjIw1mNCq000jcWZlrYQ9lCN1t0uJ+1vII3qkd7uiMh nJkgXSDUwcC+54h1wtqg/L4cS75/6b8IuE4ALhwNrZymWRClpZSVRKAPd0Ws8DVS3TNM dw0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id br21si9118979pjb.14.2019.08.26.01.45.39; Mon, 26 Aug 2019 01:45:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729372AbfHZIbq (ORCPT + 99 others); Mon, 26 Aug 2019 04:31:46 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:58852 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726747AbfHZIbq (ORCPT ); Mon, 26 Aug 2019 04:31:46 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id D0093D5AD12F44246E56; Mon, 26 Aug 2019 16:31:44 +0800 (CST) Received: from [127.0.0.1] (10.177.244.145) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.439.0; Mon, 26 Aug 2019 16:31:42 +0800 Subject: Re: [PATCH v5] ext4: fix potential use after free in system zone via remount with noblock_validity To: "Theodore Y. Ts'o" References: <1565869639-105420-1-git-send-email-yi.zhang@huawei.com> <20190825034000.GE5163@mit.edu> <20190826025612.GB4918@mit.edu> CC: , , From: "zhangyi (F)" Message-ID: <33767946-1e6f-5165-94b3-46e2da15172f@huawei.com> Date: Mon, 26 Aug 2019 16:31:41 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20190826025612.GB4918@mit.edu> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.177.244.145] X-CFilter-Loop: Reflected Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 2019/8/26 10:56, Theodore Y. Ts'o Wrote: > I added a missing rcu_read_lock() to prevent a suspicious RCU > warning when CONFIG_PROVE_RCU is enabled: > > diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c > index 003dc1dc2da3..f7bc914a74df 100644 > --- a/fs/ext4/block_validity.c > +++ b/fs/ext4/block_validity.c > @@ -330,11 +330,13 @@ void ext4_release_system_zone(struct super_block *sb) > { > struct ext4_system_blocks *system_blks; > > + rcu_read_lock(); > system_blks = rcu_dereference(EXT4_SB(sb)->system_blks); > rcu_assign_pointer(EXT4_SB(sb)->system_blks, NULL); > > if (system_blks) > call_rcu(&system_blks->rcu, ext4_destroy_system_zone); > + rcu_read_unlock(); > } > > int ext4_data_block_valid(struct ext4_sb_info *sbi, ext4_fsblk_t start_blk, > Hi Ted, Sorry about missing this warning, I think switch to use: system_blks = rcu_dereference_raw(EXT4_SB(sb)->system_blks); or system_blks = rcu_dereference_protected(EXT4_SB(sb)->system_blks, true); is enough to fix this waring, am I missing something? Thanks, Yi.