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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5193C4332F for ; Sat, 15 Oct 2022 01:32:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229537AbiJOBcv (ORCPT ); Fri, 14 Oct 2022 21:32:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbiJOBcu (ORCPT ); Fri, 14 Oct 2022 21:32:50 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 342266C13D for ; Fri, 14 Oct 2022 18:32:49 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Mq5Kc2bnFzDsSP; Sat, 15 Oct 2022 09:30:12 +0800 (CST) Received: from [10.174.151.185] (10.174.151.185) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 15 Oct 2022 09:32:46 +0800 Subject: Re: [PATCH 2/3] hugetlb: take hugetlb vma_lock when clearing vma_lock->vma pointer To: Mike Kravetz , , CC: Muchun Song , David Hildenbrand , Sven Schnelle , Michal Hocko , Peter Xu , Naoya Horiguchi , "Aneesh Kumar K . V" , Andrea Arcangeli , "Kirill A . Shutemov" , Davidlohr Bueso , Prakash Sangappa , James Houghton , Mina Almasry , Pasha Tatashin , Axel Rasmussen , Ray Fucillo , Andrew Morton References: <20221005011707.514612-1-mike.kravetz@oracle.com> <20221005011707.514612-3-mike.kravetz@oracle.com> From: Miaohe Lin Message-ID: <6b2d8b41-1989-b28a-d558-3423432848fe@huawei.com> Date: Sat, 15 Oct 2022 09:32:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.151.185] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/10/6 11:30, Mike Kravetz wrote: > To address build issues: > > >>>From b6d359f77d32c7734fe4f00806a0ed1e99925534 Mon Sep 17 00:00:00 2001 > From: Mike Kravetz > Date: Wed, 5 Oct 2022 20:26:19 -0700 > Subject: [PATCH 2/3] hugetlb: take hugetlb vma_lock when clearing > vma_lock->vma pointer > > hugetlb file truncation/hole punch code may need to back out and take > locks in order in the routine hugetlb_unmap_file_folio(). This code > could race with vma freeing as pointed out in [1] and result in > accessing a stale vma pointer. To address this, take the vma_lock when > clearing the vma_lock->vma pointer. > > [1] https://lore.kernel.org/linux-mm/01f10195-7088-4462-6def-909549c75ef4@huawei.com/ > > Fixes: "hugetlb: use new vma_lock for pmd sharing synchronization" > Signed-off-by: Mike Kravetz This patch looks good to me. Thanks. Reviewed-by: Miaohe Lin Thanks, Miaohe Lin