From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795053388; b=IKJYx5s+yvLJSIO9LEabnH26GKgq3VfIRE5QBsU2oueoIzyzSp3i6qyAn9zPpvYxhQmN 2/jgM6jvPrv9oN8ee9e0noJmmjnXIyLlASadQSKkyE3enNuVXLywmHKOE6MIC4ZnRwT0m AFh2uAGU1Z8abuz6xi2GV5GsMKWKdLaPEsQHXGj9YjMJ2awiHzG6BeHfFY7mzMS69iO6T jQaniOUOqhoFGovbhHYbhM7VG5LoKihKALlxizdwhYhz5tvrT0nantvVFa9DDkXl7/wgA b/G0qyqX5X4g69fRlhdF3NH3na5tpDaKxYvn/agPLcsfcWYqb9WXQ3mFtH0MZzFI+3A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795053388; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=w2dQjT3vNd9S+IgqtXKPcehyp62QoxwSxj5KsQ/62qs=; b=MEknOZQQsJPDpiNsQn+x8oBzKhUgO1xAunUllDByDIQb/a2lJsfZFMeYTX/DWoeD8ZQ3 d2WE1NKQzQ/mlcklfMESmofe6vTXYK9O1t0Xcknu6IjBcYA6nffKp84IK/s9bKsFz4paH q0uqQpMdBS8IhYR4DJzu/UCcVtRp8dSXpW9OzP5hgM5+vUpbhsWkjdH5kVRXfH5r0FYQt TGSyj8z2bSGqEuB+L7sxz9ZoPZAnPNK0rIK1hRRLUcRgJfHM5R/6FGbH5INWyEkYGOcuJ T02pB78ATbV76V/hhvcVaUC0Mph8wkvZICtO6CTDwqT68YAw2XSEgyLxqB5PN4xfbIw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=ZQXiFj7X; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13EAE606A32A; Thu, 19 Nov 2026 01:56:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=ZQXiFj7X Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C27E1F000C4; Thu, 19 Nov 2026 01:56:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795053387; bh=w2dQjT3vNd9S+IgqtXKPcehyp62QoxwSxj5KsQ/62qs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ZQXiFj7XDbEffHJoj4JisDGToF/9uD+10wil1xSb9Wqs2FVoax4qT/wxTXzmD8qsA LxNMRdQH4PnA7LhJATUlcVWmTr5LFZWCzODu/TdaYW4HtMmoF1uQ4Jp1fbJQT9k0dp YewiI1Lb9OMCaWXvXDd/iZtKDQcV2I5WfkAkI3aA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Josef Bacik , "Lorenzo Stoakes (ARM)" , Qi Zheng , "Gregory Price (Meta)" , Dev Jain , Muchun Song , Pedro Falcato , SJ Park , Muhammad Usama Anjum , "David Hildenbrand (Arm)" , Sasha Levin Subject: [PATCH 5.15 0903/2214] mm/mmu_gather: fix flushing ranges with 4 GiB or larger Date: Wed, 18 Nov 2026 15:42:59 +0100 Message-ID: <20261118150048.400221330@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150009.797899913@linuxfoundation.org> References: <20261118150009.797899913@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Josef Bacik [ Upstream commit 64ae7959a1df8af8eec504e31df2ec9670424a4e ] __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 have 16 GiB hugetlb folios mapped contiguously at the PMD level and flush them when unmapping, 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 by properly using "unsigned long" for range_size. 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 ] Reviewed-by: Qi Zheng Reviewed-by: Gregory Price (Meta) Tested-by: Gregory Price (Meta) Reviewed-by: Dev Jain Reviewed-by: Muchun Song Reviewed-by: Pedro Falcato Reviewed-by: SJ Park Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-27-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin --- 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 c4989227b4102..75f94288d413c 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -324,8 +324,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); -- 2.53.0