]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/page_table_check: reinstate address parameter in [__]page_table_check_pud_clear()
authorRohan McLure <rmclure@linux.ibm.com>
Wed, 13 Aug 2025 06:26:07 +0000 (16:26 +1000)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 18 Aug 2025 05:08:55 +0000 (22:08 -0700)
This reverts commit 931c38e16499 ("mm/page_table_check: remove unused
parameter in [__]page_table_check_pud_clear").

Reinstate previously unused parameters for the purpose of supporting
powerpc platforms, as many do not encode user/kernel ownership of the page
in the pte, but instead in the address of the access.

[ajd@linux.ibm.com: rebase on arm64 changes]
Link: https://lkml.kernel.org/r/20250813062614.51759-7-ajd@linux.ibm.com
Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Acked-by: Ingo Molnar <mingo@kernel.org> [x86]
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Nicholas Miehlbradt <nicholas@linux.ibm.com>
Cc: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/arm64/include/asm/pgtable.h
arch/x86/include/asm/pgtable.h
include/linux/page_table_check.h
include/linux/pgtable.h
mm/page_table_check.c

index 06ea6a4f300b8555e5e83c43eab82ea76c020a01..81f06e5e32b222dc3b2eec133de14e2f62e21b98 100644 (file)
@@ -1374,7 +1374,7 @@ static inline pte_t __ptep_get_and_clear_anysz(struct mm_struct *mm,
                break;
 #ifndef __PAGETABLE_PMD_FOLDED
        case PUD_SIZE:
-               page_table_check_pud_clear(mm, pte_pud(pte));
+               page_table_check_pud_clear(mm, address, pte_pud(pte));
                break;
 #endif
        default:
index 8ee301b16b504b9f8c5be5fe7947b98234654ad0..8b45e0c41923183d09dbd863edd1f2bd842a269a 100644 (file)
@@ -1329,7 +1329,7 @@ static inline pud_t pudp_huge_get_and_clear(struct mm_struct *mm,
 {
        pud_t pud = native_pudp_get_and_clear(pudp);
 
-       page_table_check_pud_clear(mm, pud);
+       page_table_check_pud_clear(mm, addr, pud);
 
        return pud;
 }
index 66e10923841691a59620da8d17f7bb7b09e6a6d3..808cc3a48c28fcf988ba2c50031fa4f317496582 100644 (file)
@@ -16,7 +16,8 @@ extern struct page_ext_operations page_table_check_ops;
 void __page_table_check_zero(struct page *page, unsigned int order);
 void __page_table_check_pte_clear(struct mm_struct *mm, pte_t pte);
 void __page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd);
-void __page_table_check_pud_clear(struct mm_struct *mm, pud_t pud);
+void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr,
+                                 pud_t pud);
 void __page_table_check_ptes_set(struct mm_struct *mm, unsigned long addr,
                pte_t *ptep, pte_t pte, unsigned int nr);
 void __page_table_check_pmds_set(struct mm_struct *mm, unsigned long addr,
@@ -59,12 +60,13 @@ static inline void page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd)
        __page_table_check_pmd_clear(mm, pmd);
 }
 
-static inline void page_table_check_pud_clear(struct mm_struct *mm, pud_t pud)
+static inline void page_table_check_pud_clear(struct mm_struct *mm,
+                                             unsigned long addr, pud_t pud)
 {
        if (static_branch_likely(&page_table_check_disabled))
                return;
 
-       __page_table_check_pud_clear(mm, pud);
+       __page_table_check_pud_clear(mm, addr, pud);
 }
 
 static inline void page_table_check_ptes_set(struct mm_struct *mm,
@@ -123,7 +125,8 @@ static inline void page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd)
 {
 }
 
-static inline void page_table_check_pud_clear(struct mm_struct *mm, pud_t pud)
+static inline void page_table_check_pud_clear(struct mm_struct *mm,
+                                             unsigned long addr, pud_t pud)
 {
 }
 
index e6e022fec24655bd61e0b5db1afacd322a81c425..2ea068a6639ac55ca14c15be253214edce44595f 100644 (file)
@@ -661,7 +661,7 @@ static inline pud_t pudp_huge_get_and_clear(struct mm_struct *mm,
        pud_t pud = *pudp;
 
        pud_clear(pudp);
-       page_table_check_pud_clear(mm, pud);
+       page_table_check_pud_clear(mm, address, pud);
 
        return pud;
 }
index 0957767a2940409bdaa6e61cb34b18eae3cb45f9..bd1242087a358dd52266bcc65f167d9e8defbd31 100644 (file)
@@ -167,7 +167,8 @@ void __page_table_check_pmd_clear(struct mm_struct *mm, pmd_t pmd)
 }
 EXPORT_SYMBOL(__page_table_check_pmd_clear);
 
-void __page_table_check_pud_clear(struct mm_struct *mm, pud_t pud)
+void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr,
+                                 pud_t pud)
 {
        if (&init_mm == mm)
                return;
@@ -246,7 +247,7 @@ void __page_table_check_puds_set(struct mm_struct *mm, unsigned long addr,
                return;
 
        for (i = 0; i < nr; i++)
-               __page_table_check_pud_clear(mm, *(pudp + i));
+               __page_table_check_pud_clear(mm, addr + PUD_SIZE * i, *(pudp + i));
        if (pud_user_accessible_page(pud))
                page_table_check_set(pud_pfn(pud), stride * nr, pud_write(pud));
 }