Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C16A8248B; Tue, 28 Jul 2026 01:28:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785202134; cv=none; b=muKKjIkX3tB1L+0lNXpebzgwYxQzDZDQaT5273alfNqEtiJpFIU4B/SBjC+z+yoI6V6+m+TOoQJXTCPMqW6KE5HDm9c3hNWtZnjUITOjBr1epsVniL6JWJRzefdJh1VBsTn9mHBdowazb39zsxP6vQpfgWqsaq9BtJYY+T2WoAs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785202134; c=relaxed/simple; bh=E4JrU95BDQOc0u16SkbvpkHLELR+qJpqdXKNRfRaYqo=; h=Date:To:From:Subject:Message-Id; b=DVlIjXdOlVZwHpJDTxQfJQzvj6ew8qtrESMIye7S7E4UbF1GlHWq7MoTwxEeuDXuwECB38DLjNIhxbmd37zpU5YDnIw/E9TVT+j7ZUQmYiczFQ2XlVqZltdJz/nJL5EPKKxjozGbfQT6MMq1F2PmVdLYtri6ksY6Xo8TKy7zuoc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=d5qakGDh; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="d5qakGDh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A53A1F000E9; Tue, 28 Jul 2026 01:28:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1785202131; bh=h+K0VOo1V0eUC/PbK5Hnia6XBnC2F/6+RzeXykArerE=; h=Date:To:From:Subject; b=d5qakGDhvCMRTDiQEjV1Rva9Dde09+juhqxhySe3+F++OcABoY9SjQti3YE6FxNgX e7+Bp7gL93gyApEF/yG4jTknnpfXLB3LNVXqX4cHq7r7x9vnKqYRee3gUgFng0I0cd hMKaYnGqD0QT0EK9xFaOf5ad5PDZN48M73HUIikI= Date: Mon, 27 Jul 2026 18:28:50 -0700 To: mm-commits@vger.kernel.org,ziy@nvidia.com,ying.huang@linux.alibaba.com,will@kernel.org,vbabka@kernel.org,stable@vger.kernel.org,ryan.roberts@arm.com,riel@surriel.com,rcampbell@nvidia.com,rakie.kim@sk.com,pfalcato@suse.de,osalvador@suse.de,nao.horiguchi@gmail.com,muchun.song@linux.dev,mel@csn.ul.ie,matthew.brost@intel.com,ljs@kernel.org,liam@infradead.org,lance.yang@linux.dev,kas@kernel.org,jpoimboe@kernel.org,joshua.hahnjy@gmail.com,j-nomura@ce.jp.nec.com,jannh@google.com,harry@kernel.org,gourry@gourry.net,david@kernel.org,dave.hansen@intel.com,catalin.marinas@arm.com,byungchul@sk.com,apopple@nvidia.com,anshuman.khandual@arm.com,ak@linux.intel.com,dev.jain@arm.com,akpm@linux-foundation.org From: Andrew Morton Subject: [merged] arm64-make-huge_ptep_get-handled-unaligned-addresses.patch removed from -mm tree Message-Id: <20260728012851.2A53A1F000E9@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The quilt patch titled Subject: arm64: make huge_ptep_get handled unaligned addresses has been removed from the -mm tree. Its filename was arm64-make-huge_ptep_get-handled-unaligned-addresses.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ From: Dev Jain Subject: arm64: make huge_ptep_get handled unaligned addresses Date: Fri, 3 Jul 2026 11:41:54 +0000 Patch series "Fix incorrect access of hugetlb pte entries", v3. There are various places which use ptep_get() to get the pte entry corresponding to a hugetlb folio. Some arches (like s390) have special handling to compute the pteval, so they provide huge_ptep_get(). Use this helper consistently. Additionally, some code paths may provide huge_ptep_get with an unaligned address. This is a problem on arm64 (I checked other arches and it looks fine for them), which is fixed in patch 1. The fix is made to be backport-friendly: the cleaner fix would be to perhaps pass the hstate to huge_ptep_get() - that is wider churn and we can do that later. This patch (of 6): huge_ptep_get() can be handed a virtual address pointing to the middle of a contpmd/contpte mapped hugetlb folio (examples of callers are pagemap_hugetlb_range, page_mapped_in_vma). The arm64 helper rewalks the pgtables in find_num_contig to answer whether the huge pte we have maps a contpmd or a contpte hugetlb folio, and returns CONT_PMDS or CONT_PTES, so that it can collect a/d bits over the contiguous ptes. We can falsely return CONT_PTES instead of CONT_PMDS if the addr is not aligned. THis mean that on systems where CONT_PTES != CONT_PMDS (meaning page size is 16K) we could collect excess a/d bit state, meaning extra work for the kernel. Fix this by aligning the pmdp pointer down to a contpmd base before checking equality with the passed huge pte pointer, to correctly answer whether the huge pte is the base of a contpmd block. Link: https://lore.kernel.org/20260703114202.365553-1-dev.jain@arm.com Link: https://lore.kernel.org/20260703114202.365553-2-dev.jain@arm.com Fixes: 29cb80519689 ("arm64: hugetlb: Cleanup huge_pte size discovery mechanisms") Signed-off-by: Dev Jain Acked-by: David Hildenbrand (Arm) Acked-by: Muchun Song Cc: Alistair Popple Cc: Andi Kleen Cc: Anshuman Khandual Cc: Byungchul Park Cc: Catalin Marinas Cc: Dave Hansen Cc: Gregory Price Cc: Harry Yoo Cc: "Huang, Ying" Cc: Jann Horn Cc: Josh Poimboeuf Cc: Joshua Hahn Cc: Jun'ichi "Nick" Nomura Cc: Kiryl Shutsemau Cc: Lance Yang Cc: Liam R. Howlett Cc: Lorenzo Stoakes Cc: Matthew Brost Cc: Mel Gorman Cc: Naoya Horiguchi Cc: Oscar Salvador Cc: Pedro Falcato Cc: Rakie Kim Cc: Ralph Campbell Cc: Rik van Riel Cc: Ryan Roberts Cc: Vlastimil Babka Cc: Will Deacon Cc: Zi Yan Cc: Signed-off-by: Andrew Morton --- arch/arm64/mm/hugetlbpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm64/mm/hugetlbpage.c~arm64-make-huge_ptep_get-handled-unaligned-addresses +++ a/arch/arm64/mm/hugetlbpage.c @@ -87,7 +87,7 @@ static int find_num_contig(struct mm_str p4dp = p4d_offset(pgdp, addr); pudp = pud_offset(p4dp, addr); pmdp = pmd_offset(pudp, addr); - if ((pte_t *)pmdp == ptep) { + if ((pte_t *)PTR_ALIGN_DOWN(pmdp, sizeof(*pmdp) * CONT_PMDS) == ptep) { *pgsize = PMD_SIZE; return CONT_PMDS; } _ Patches currently in -mm which might be from dev.jain@arm.com are mm-swap-rename-subpage-page-in-folio_dup_swap-folio_put_swap.patch mm-mprotect-drop-sub-from-batching-context.patch mm-rmap-use-huge_ptep_get-in-try_to_unmap_one.patch mm-rmap-use-huge_ptep_get-in-try_to_migrate_one.patch mm-migrate-use-huge_ptep_get-in-remove_migration_pte.patch mm-page_vma_mapped-use-huge_ptep_get-for-hugetlb.patch mm-mprotect-use-huge_ptep_get-for-hugetlb.patch mm-rmap-convert-page-folio-for-hwpoison-checks.patch mm-rmap-add-try_to_unmap_hugetlb_one.patch mm-rmap-refactor-some-code-around-lazyfree-folio-unmapping.patch mm-rmap-refactor-anon-folio-unmap-in-try_to_unmap_one.patch mm-rmap-add-anon-folio-unmap-dispatcher.patch mm-memory-move-pte_install_uffd_wp_if_needed-into-memoryc.patch mm-memory-batch-set-uffd-wp-markers-during-zapping.patch mm-rmap-batch-unmap-file-folios-belonging-to-uffd-wp-vmas.patch