mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-28 19:06:51 +01:00
This reverts commit aa232204c4 ("mm/page_table_check: remove unused
parameter in [__]page_table_check_pte_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, fix additional occurrence and loop handling]
Link: https://lkml.kernel.org/r/20251219-pgtable_check_v18rebase-v18-8-755bc151a50b@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
Acked-by: Alexandre Ghiti <alexghiti@rivosinc.com> # riscv
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Donet Tom <donettom@linux.ibm.com>
Cc: Guo Weikang <guoweikang.kernel@gmail.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Kevin Brodsky <kevin.brodsky@arm.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Magnus Lindholm <linmag7@gmail.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Miehlbradt <nicholas@linux.ibm.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Paul Mackerras <paulus@ozlabs.org>
Cc: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Cc: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Cc: Thomas Huth <thuth@redhat.com>
Cc: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
167 lines
4.5 KiB
C
167 lines
4.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/*
|
|
* Copyright (c) 2021, Google LLC.
|
|
* Pasha Tatashin <pasha.tatashin@soleen.com>
|
|
*/
|
|
#ifndef __LINUX_PAGE_TABLE_CHECK_H
|
|
#define __LINUX_PAGE_TABLE_CHECK_H
|
|
|
|
#ifdef CONFIG_PAGE_TABLE_CHECK
|
|
#include <linux/jump_label.h>
|
|
|
|
extern struct static_key_true page_table_check_disabled;
|
|
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, unsigned long addr,
|
|
pte_t pte);
|
|
void __page_table_check_pmd_clear(struct mm_struct *mm, unsigned long addr,
|
|
pmd_t pmd);
|
|
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,
|
|
pmd_t *pmdp, pmd_t pmd, unsigned int nr);
|
|
void __page_table_check_puds_set(struct mm_struct *mm, unsigned long addr,
|
|
pud_t *pudp, pud_t pud, unsigned int nr);
|
|
void __page_table_check_pte_clear_range(struct mm_struct *mm,
|
|
unsigned long addr,
|
|
pmd_t pmd);
|
|
|
|
static inline void page_table_check_alloc(struct page *page, unsigned int order)
|
|
{
|
|
if (static_branch_likely(&page_table_check_disabled))
|
|
return;
|
|
|
|
__page_table_check_zero(page, order);
|
|
}
|
|
|
|
static inline void page_table_check_free(struct page *page, unsigned int order)
|
|
{
|
|
if (static_branch_likely(&page_table_check_disabled))
|
|
return;
|
|
|
|
__page_table_check_zero(page, order);
|
|
}
|
|
|
|
static inline void page_table_check_pte_clear(struct mm_struct *mm,
|
|
unsigned long addr, pte_t pte)
|
|
{
|
|
if (static_branch_likely(&page_table_check_disabled))
|
|
return;
|
|
|
|
__page_table_check_pte_clear(mm, addr, pte);
|
|
}
|
|
|
|
static inline void page_table_check_pmd_clear(struct mm_struct *mm,
|
|
unsigned long addr, pmd_t pmd)
|
|
{
|
|
if (static_branch_likely(&page_table_check_disabled))
|
|
return;
|
|
|
|
__page_table_check_pmd_clear(mm, addr, pmd);
|
|
}
|
|
|
|
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, addr, pud);
|
|
}
|
|
|
|
static inline void page_table_check_ptes_set(struct mm_struct *mm,
|
|
unsigned long addr, pte_t *ptep,
|
|
pte_t pte, unsigned int nr)
|
|
{
|
|
if (static_branch_likely(&page_table_check_disabled))
|
|
return;
|
|
|
|
__page_table_check_ptes_set(mm, addr, ptep, pte, nr);
|
|
}
|
|
|
|
static inline void page_table_check_pmds_set(struct mm_struct *mm,
|
|
unsigned long addr, pmd_t *pmdp, pmd_t pmd, unsigned int nr)
|
|
{
|
|
if (static_branch_likely(&page_table_check_disabled))
|
|
return;
|
|
|
|
__page_table_check_pmds_set(mm, addr, pmdp, pmd, nr);
|
|
}
|
|
|
|
static inline void page_table_check_puds_set(struct mm_struct *mm,
|
|
unsigned long addr, pud_t *pudp, pud_t pud, unsigned int nr)
|
|
{
|
|
if (static_branch_likely(&page_table_check_disabled))
|
|
return;
|
|
|
|
__page_table_check_puds_set(mm, addr, pudp, pud, nr);
|
|
}
|
|
|
|
static inline void page_table_check_pte_clear_range(struct mm_struct *mm,
|
|
unsigned long addr,
|
|
pmd_t pmd)
|
|
{
|
|
if (static_branch_likely(&page_table_check_disabled))
|
|
return;
|
|
|
|
__page_table_check_pte_clear_range(mm, addr, pmd);
|
|
}
|
|
|
|
#else
|
|
|
|
static inline void page_table_check_alloc(struct page *page, unsigned int order)
|
|
{
|
|
}
|
|
|
|
static inline void page_table_check_free(struct page *page, unsigned int order)
|
|
{
|
|
}
|
|
|
|
static inline void page_table_check_pte_clear(struct mm_struct *mm,
|
|
unsigned long addr, pte_t pte)
|
|
{
|
|
}
|
|
|
|
static inline void page_table_check_pmd_clear(struct mm_struct *mm,
|
|
unsigned long addr, pmd_t pmd)
|
|
{
|
|
}
|
|
|
|
static inline void page_table_check_pud_clear(struct mm_struct *mm,
|
|
unsigned long addr, pud_t pud)
|
|
{
|
|
}
|
|
|
|
static inline void page_table_check_ptes_set(struct mm_struct *mm,
|
|
unsigned long addr, pte_t *ptep,
|
|
pte_t pte, unsigned int nr)
|
|
{
|
|
}
|
|
|
|
static inline void page_table_check_pmds_set(struct mm_struct *mm,
|
|
unsigned long addr, pmd_t *pmdp, pmd_t pmd, unsigned int nr)
|
|
{
|
|
}
|
|
|
|
static inline void page_table_check_puds_set(struct mm_struct *mm,
|
|
unsigned long addr, pud_t *pudp, pud_t pud, unsigned int nr)
|
|
{
|
|
}
|
|
|
|
static inline void page_table_check_pte_clear_range(struct mm_struct *mm,
|
|
unsigned long addr,
|
|
pmd_t pmd)
|
|
{
|
|
}
|
|
|
|
#endif /* CONFIG_PAGE_TABLE_CHECK */
|
|
|
|
#define page_table_check_pmd_set(mm, addr, pmdp, pmd) page_table_check_pmds_set(mm, addr, pmdp, pmd, 1)
|
|
#define page_table_check_pud_set(mm, addr, pudp, pud) page_table_check_puds_set(mm, addr, pudp, pud, 1)
|
|
|
|
#endif /* __LINUX_PAGE_TABLE_CHECK_H */
|