From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.196 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793070410; b=a9/9VvrN5QRcmAhWSjD8OFT9rr0CfoZT3JTYKnrLro9TRU573WDFI+mrDRpHGdoC5Hcn savzducCHztliH70IQRIrm50GJISb2afOd1Pvr5a0Ifnbk5AlazxeMP7Q5uusbtkjANJR 4Kr3ot53F3gNEfSNQzKPDR7TO81U+1g1hJZf/0YHrYhlMEwdxdgw0oMKC/zKIIdxUiGNy mbrZE7aparAzOf/xeN6HrgR0edUOZxI16cFunymqG/eT4M5NY8i12QA6IpIlkUhlWgBBz j4he40UjpugXw9dKKRiDRZtKl7ujG34HXVRM25rTFdjPDQ1H6PUkEsYTY2fMCqdjBuw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793070410; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=NfiBYouQ7SUxOIRjsg6uwpg+DvPUrarmQVPVZOSrssU=; b=Pzu7WwTURB56Q/2YMMRIl2A3DOxQmPESLfaKfyclM211ScLUlnqVfT4QwGpMyi8wBeVi 4+AodhNbErqsbc0HSbqWJ+6L0xv5elZplyxqy6QoMIyqrSBr+xhuiXcErsGtw4hsJj2HE g2vlIM3phSAjKeGHIrAVoz9KhLeh2EPzsfgWBNk3zALf0ieYKQdQZQv9FoEseha5Fp994 XYGnFpNs8gsP6tFi1R0JB2qKxc4WzwwdKWIJXE10K3KCRxWsSUz8Z6pJWAsy7gKHRS3JF lzg6v8aamTqdQ70OmDWceHoQdpZYyhtTJUMnQLtTWkyjoR9nAlqFg10gkuR3K4xQarA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=OmJvHkyF; arc=none smtp.remote-ip=95.215.58.196 Received: from mta1.migadu.com (out-196.mta1.migadu.com [95.215.58.196]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6EE6606A31E for ; Tue, 27 Oct 2026 03:06:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A6EE6606A31E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=OmJvHkyF X-Envelope-To: linux-cxl@vger.kernel.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: linux-cxl@vger.kernel.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-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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 >