Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp843823pxb; Thu, 15 Apr 2021 07:55:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy35GweNjMoZ3/9dtSy/TH4O+KGjPeiX7Zz3SV0gGilJb9Oy2R0DluERT9CJ52AjtwCn7Sf X-Received: by 2002:a17:90a:4a8f:: with SMTP id f15mr4459860pjh.19.1618498552097; Thu, 15 Apr 2021 07:55:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618498552; cv=none; d=google.com; s=arc-20160816; b=EdpJdJaLmuLo8NqvjnvL0Tw8a+9Mx8r19qTOFs4jASCFUSHfnNeySwkBOTjwWDyGzR 6WykbHkz2FtwAoWXxZe2x/M9IgcHu+DiVWrxx1FJwdcaTTEt/CN8AiX+OeCVcmywLpKb OXVRM82teaSusinFfKYSl74fNY68D/2iptF9w3SDJQ8SrCf/z/PJuJoywpi96Z4kkR8f F2+Jye1aaZFlBmtMEvbdGoSYPoDZHKpzNCfNSBsBwxq1lBd+2cIynWMd4docE2++tc4F 4Ak15JIyfotnr2zrb2+311qp0zxo+fGyr2jeJos2ZxHfw5ISEil48lUxhxUmfl2IZ/rX Gg2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=C3gAoqVJbNHaFnVpwiCtlJm6hLmAHtP5KFU8HTA8ghw=; b=iwLAe1qE7vLJp66QJCc35TvfJUzQhH6lQgEYVjtA9BWxksh6MnNzPQBiFAfoLFKfUE yPjEg1ofAAWsoK2MfRNTSdl6VvPanbOJ6yknVwbt9DZaZj0rvB5vYbFQrQkywkFsIcdv Yfi8c+2E8h9wvOBy91YjrflrqM+A1EyU6SlYnQy6O/9DqdhyKo6k3YHTPDbHSFqRWklN 6ZAVk1EBuvUKS6K+Q4Of9ets3TVw5k323VPelxCOLGXGJb1ENfAyaKH7eLTW3jT+onzi 0R3ulT2p4YlTnn9FWy4GPDATUcqcOSHcniXCG0mqHwSdhH1px3ZaNwLrE4iOWdC7M389 wAFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=iGHVKQkM; 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 o26si3155733pgv.264.2021.04.15.07.55.39; Thu, 15 Apr 2021 07:55:52 -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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=iGHVKQkM; 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 S234235AbhDOOzM (ORCPT + 99 others); Thu, 15 Apr 2021 10:55:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234290AbhDOOx7 (ORCPT ); Thu, 15 Apr 2021 10:53:59 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85925C06134D; Thu, 15 Apr 2021 07:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=C3gAoqVJbNHaFnVpwiCtlJm6hLmAHtP5KFU8HTA8ghw=; b=iGHVKQkMSm0+27XKnHvlajsJCv 4kR0v8sl5YK50iM2k3eZUSfbThB7vL3XjfdE6fQ4eMSfSMS52q4eVr5Gr8Sb/kwFT2jJNbHKmECRw CCJEgp5Y0XiWPpIJiPDakzGWLfXO7tckZcBgy256Te8tHLdaoODdKQOHMDxMTJipVsUB+q4FlSmGC a1bVml7oIJ2sGyjHyoC4hC4qAZbwTkNzcn1VgswgXUDWl6zuUZGDhO6o1PI/xe+iEOqx07XkNhTiq MXCcTwnwPXUxSktS25GWcknDlCl2XdinvaMQCoaMN2/jBtZM8LFSAkhVzl5l+TeW4x9UnvGSoSluN m3VoPtng==; Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lX3MB-008hIz-HL; Thu, 15 Apr 2021 14:52:44 +0000 Date: Thu, 15 Apr 2021 15:52:35 +0100 From: Christoph Hellwig To: Zhang Yi Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, yukuai3@huawei.com Subject: Re: [RFC PATCH v2 7/7] ext4: fix race between blkdev_releasepage() and ext4_put_super() Message-ID: <20210415145235.GD2069063@infradead.org> References: <20210414134737.2366971-1-yi.zhang@huawei.com> <20210414134737.2366971-8-yi.zhang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210414134737.2366971-8-yi.zhang@huawei.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed, Apr 14, 2021 at 09:47:37PM +0800, Zhang Yi wrote: > There still exist a use after free issue when accessing the journal > structure and ext4_sb_info structure on freeing bdev buffers in > bdev_try_to_free_page(). The problem is bdev_try_to_free_page() could be > raced by ext4_put_super(), it dose freeing sb->s_fs_info and > sbi->s_journal while release page progress are still accessing them. > So it could end up trigger use-after-free or NULL pointer dereference. I think the right fix is to not even call into ->bdev_try_to_free_page unless the superblock is active.