Patch "arm64/mm: Ensure adequate HUGE_MAX_HSTATE" has been added to the 6.12-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    arm64/mm: Ensure adequate HUGE_MAX_HSTATE

to the 6.12-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     arm64-mm-ensure-adequate-huge_max_hstate.patch
and it can be found in the queue-6.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 96a6dec94bd0151da2aced144f57e00f26e95900
Author: Anshuman Khandual <anshuman.khandual@xxxxxxx>
Date:   Mon Dec 2 12:14:07 2024 +0530

    arm64/mm: Ensure adequate HUGE_MAX_HSTATE
    
    [ Upstream commit 1e5823c8e86de83a43d59a522b4de29066d3b306 ]
    
    This asserts that HUGE_MAX_HSTATE is sufficient enough preventing potential
    hugetlb_max_hstate runtime overflow in hugetlb_add_hstate() thus triggering
    a BUG_ON() there after.
    
    Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
    Cc: Will Deacon <will@xxxxxxxxxx>
    Cc: Ard Biesheuvel <ardb@xxxxxxxxxx>
    Cc: Ryan Roberts <ryan.roberts@xxxxxxx>
    Cc: Mark Rutland <mark.rutland@xxxxxxx>
    Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
    Cc: linux-kernel@xxxxxxxxxxxxxxx
    Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>
    Reviewed-by: Ryan Roberts <ryan.roberts@xxxxxxx>
    Reviewed-by: Gavin Shan <gshan@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241202064407.53807-1-anshuman.khandual@xxxxxxx
    Signed-off-by: Will Deacon <will@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index 5f1e2103888b7..0a6956bbfb326 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -508,6 +508,18 @@ pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
 
 static int __init hugetlbpage_init(void)
 {
+	/*
+	 * HugeTLB pages are supported on maximum four page table
+	 * levels (PUD, CONT PMD, PMD, CONT PTE) for a given base
+	 * page size, corresponding to hugetlb_add_hstate() calls
+	 * here.
+	 *
+	 * HUGE_MAX_HSTATE should at least match maximum supported
+	 * HugeTLB page sizes on the platform. Any new addition to
+	 * supported HugeTLB page sizes will also require changing
+	 * HUGE_MAX_HSTATE as well.
+	 */
+	BUILD_BUG_ON(HUGE_MAX_HSTATE < 4);
 	if (pud_sect_supported())
 		hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux