From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.194 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793070410; b=XaGokRcddz8n3BTx2Qj1Pk+LP3ME+V15VOFgICV0GW7C4Ot8QR4HfhGMzKjAHx3GQrpA qMLVKre/8RI4u3iVp7+P1pLPmkQHzA8gAd5d6girkVwdaC8aR+YjcTrrfS1ACD3qlTUfq JO1/WUUFdJO/avjNQ+3X4mjg6xGEl050tJ2d+dPP3OAi9PnjsP9faL5/hqIvBNRZPu04H GmF8jP1MShKoyNc0MV3NdDDauYNtCcVS2QoFRFuD+BLRWxX8hMnJoZ/+SIsrV45aBYG1o bjmSz5AY3+fKhbDKOv0aD4D0yYe1eG9w90qW354HrrqvFFa8LgAO95//wI+8Pas6X7g== 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=Dq8FiFeab+MopO3EDti9vbEAg/hoiivHJGhEzucfcEelQzTf0SXcEdaCfPCkRIZcQn9f KwX/CxvgM2nYKPGaXLj20N9OhvORX8K72XTClomcup5QTUvJICMtmCCS1E6JPZiUo7fPB WSTuUJSIjMpIk56kfmoFdsJW0fY5aKhTtnxXMq4nYi8RkXgPyv+rux7P2IZ8ighKFEF+h ruXER1izmnXhuOUoLaf6XvHQ98M+SBBU1OpiJdzJTRa+hsNqgRLQcHmeNqgJDTJlZ8C1q aqdrfmcAI1ZgdmZCsJ3rInyiwLqTrY4GBEAdHoL45aALuxvD7G1VXKzzQH6d8n4Yj5g== 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.194 Received: from mta1.migadu.com (out-194.mta1.migadu.com [95.215.58.194]) (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 A9D01606A31F for ; Tue, 27 Oct 2026 03:06:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A9D01606A31F 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-arch@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-arch@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-arch@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 >