From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BD3E606A329 for ; Tue, 27 Oct 2026 03:06:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=VW/iqzBh; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=OmJvHkyF DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=NfiBYouQ7SUxOIRjsg6uwpg+DvPUrarmQVPVZOSrssU=; b=VW/iqzBh+f6s92 TfdIdp72l3OSL+a8uBf8MSIMk/UArLapHuDgaoYOFbLntoh1GWN5k2BLrd1KK1p0hLkx2Wvs6IbCr OxcBFtf713/05e7RiY9dymdlTf2aidddF344koLPcWv/jkxlwFYfxwhBbOUB2fRLQCIZJ0uYIe0H0 h+vcdOYm4Ublf+g+CvOtf/9xVlcfKI4FNtx5I48lXaDKUJu7tD7jzjIVIuWvwVJT8r9ksyW3gHAxP JbyV6LMg0f39DtJAuhuLNcugpVbqRxDyAxQpZXoEyMAB6P5JeB7RnQWJ2iWByYYFOb1qzLM/Y10yI 5JSoRG6DV6sV50hjx3qQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xLXWV-00000003gZ9-2yIO; Tue, 27 Oct 2026 03:06:51 +0000 Received: from out-248.mta0.migadu.com ([2001:41d0:1004:224b::f8] helo=mta0.migadu.com) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xLXWT-00000003gYj-3AWD for kexec@lists.infradead.org; Tue, 27 Oct 2026 03:06:51 +0000 X-Envelope-To: kexec@lists.infradead.org DKIM-Signature: a=rsa-sha256; bh=AqI8n299OICKahJhyCKFqs0u3m8/ZWmCuQo8Rk556kA=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1793070407; v=1; x=1793675207; b=OmJvHkyFxsfeKypToUZ7LSGC2sUxdtwI3R9o6a19BnFlQ/VY2YusuFobH1ESXjXmdW4D/0v1 2U+cDF/TlFIvOXWIa+BCKSj8lSkeCR2P5jwvU83YvE2C4LcKuDnPaa1N3Qp/AhtOyPyWtF6jp0r X5a1YWHseL+TPDdj7Y10H9cA= X-Envelope-To: kexec@lists.infradead.org Received: by smtp.migadu.com with ESMTPS id fa452c266040fd6e; Tue, 27 Oct 2026 03:06:46 +0000 X-Mizu-Trace-ID: fa452c266040fd6e X-Migadu-Flow: FLOW_OUT Message-ID: Date: Tue, 27 Oct 2026 11:06:27 +0800 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 26/46] mm/mmu_gather: fix flushing ranges with 4 GiB or larger To: "David Hildenbrand (Arm)" , Andrew Morton , Johannes Weiner , Michal Hocko , Shakeel Butt , Lorenzo Stoakes , Kairui Song , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Baoquan He , Baolin Wang , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Kees Cook , Peter Zijlstra , Jann Horn , Pedro Falcato , Hugh Dickins , Pasha Tatashin , Pratyush Yadav , "Matthew Wilcox (Oracle)" , Jan Kara , Zi Yan , Lance Yang , Rik van Riel , Harry Yoo , Alistair Popple , Nico Pache , Ryan Roberts , Dev Jain , Usama Arif , Kiryl Shutsemau , Matthew Brost , John Hubbard , Peter Xu , Will Deacon , "Aneesh Kumar K.V" , Nick Piggin , Oscar Salvador , Minchan Kim , Muchun Song , Xu Xin , Chengming Zhou , Chris Li , Kemeng Shi , Nhat Pham , Youngjun Park , Gregory Price , Joshua Hahn , Rakie Kim , Ying Huang , Jason Gunthorpe Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-cxl@vger.kernel.org, Josef Bacik , stable@vger.kernel.org References: <20261027-fixes_core-v1-0-6f74bec9a5bb@kernel.org> <20261027-fixes_core-v1-26-6f74bec9a5bb@kernel.org> From: Qi Zheng In-Reply-To: <20261027-fixes_core-v1-26-6f74bec9a5bb@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261026_200649_948047_71A230F9 X-CRM114-Status: GOOD ( 18.97 ) X-Spam-Score: -2.1 (--) X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kexec" X-Spam-Status: No, score=-17.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On 10/27/26 7:17 AM, David Hildenbrand (Arm) wrote: > From: Josef Bacik > > __tlb_adjust_range() takes the size of the range which has to be flushed > as an unsigned int. Its callers, tlb_flush_{pte,pmd,pud,p4d}_range(), get > and pass an unsigned long. Consequently, a range that is 4 GiB or larger > gets truncated, possibly to 0. > > On arm64 with hugetlb, a 64k kernel can flush 16 GiB hugetlb PMDs, and a > 16k kernel can flush 64 GiB PUDs through tlb_unshare_pmd_ptdesc(). So > at least these two scenarios are affected. > > Fix it by flushing the proper range instead of the truncated one. > > Fix generated by an LLM and sent by Josef Bacik in private. > > Fixes: b528e4b6405b ("mm/hugetlb: add tlb_remove_hugetlb_entry for handling hugetlb pages") > Fixes: 8ce720d5bd91 ("mm/hugetlb: fix excessive IPI broadcasts when unsharing PMD tables using mmu_gather") > Cc: stable@vger.kernel.org > Signed-off-by: Josef Bacik > Acked-by: Lorenzo Stoakes (ARM) > [ david: use two-tab indent, simplify description ] > Signed-off-by: David Hildenbrand (Arm) > --- > include/asm-generic/tlb.h | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h > index fbe1114e9a443..3f4a180b48f3c 100644 > --- a/include/asm-generic/tlb.h > +++ b/include/asm-generic/tlb.h > @@ -350,8 +350,7 @@ struct mmu_gather { > void tlb_flush_mmu(struct mmu_gather *tlb); > > static inline void __tlb_adjust_range(struct mmu_gather *tlb, > - unsigned long address, > - unsigned int range_size) > + unsigned long address, unsigned long range_size) > { > tlb->start = min(tlb->start, address); > tlb->end = max(tlb->end, address + range_size); Reviewed-by: Qi Zheng Thanks, Qi >