提交 86f1e83e 编写于 作者: 知远pimo's avatar 知远pimo

mm: page_table_check: using PxD_SIZE instead of PxD_PAGE_SIZE

mainline inclusion
from mainline-v6.0
commit 92fb0524
category: feature
bugzilla: https://gitee.com/openeuler/open-source-summer/issues/I56FG1?from=project-issue
CVE: N/A

Reference:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=92fb05242a1b1ecfcb39d9b1421a165adf344a3c

-------------------------------------------------
Patch series "mm: page_table_check: add support on arm64 and riscv", v7.

Page table check performs extra verifications at the time when new pages
become accessible from the userspace by getting their page table entries
(PTEs PMDs etc.) added into the table.  It is supported on X86[1].

This patchset made some simple changes and make it easier to support new
architecture, then we support this feature on ARM64 and RISCV.

[1]https://lore.kernel.org/lkml/20211123214814.3756047-1-pasha.tatashin@soleen.com/

This patch (of 6):

Compared with PxD_PAGE_SIZE, which is defined and used only on X86,
PxD_SIZE is more common in each architecture.  Therefore, it is more
reasonable to use PxD_SIZE instead of PxD_PAGE_SIZE in page_table_check.c.
At the same time, it is easier to support page table check in other
architectures.  The substitution has no functional impact on the x86.

Link: https://lkml.kernel.org/r/20220507110114.4128854-1-tongtiangen@huawei.com
Link: https://lkml.kernel.org/r/20220507110114.4128854-2-tongtiangen@huawei.comSigned-off-by: NTong Tiangen <tongtiangen@huawei.com>
Suggested-by: NAnshuman Khandual <anshuman.khandual@arm.com>
Acked-by: NPasha Tatashin <pasha.tatashin@soleen.com>
Reviewed-by: NAnshuman Khandual <anshuman.khandual@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 92fb0524)
Signed-off-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NZeng Zhimin <im_zzm@126.com>
上级 03db71b7
...@@ -181,7 +181,7 @@ void __page_table_check_pmd_clear(struct mm_struct *mm, unsigned long addr, ...@@ -181,7 +181,7 @@ void __page_table_check_pmd_clear(struct mm_struct *mm, unsigned long addr,
if (pmd_user_accessible_page(pmd)) { if (pmd_user_accessible_page(pmd)) {
page_table_check_clear(mm, addr, pmd_pfn(pmd), page_table_check_clear(mm, addr, pmd_pfn(pmd),
PMD_PAGE_SIZE >> PAGE_SHIFT); PMD_SIZE >> PAGE_SHIFT);
} }
} }
EXPORT_SYMBOL(__page_table_check_pmd_clear); EXPORT_SYMBOL(__page_table_check_pmd_clear);
...@@ -194,7 +194,7 @@ void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr, ...@@ -194,7 +194,7 @@ void __page_table_check_pud_clear(struct mm_struct *mm, unsigned long addr,
if (pud_user_accessible_page(pud)) { if (pud_user_accessible_page(pud)) {
page_table_check_clear(mm, addr, pud_pfn(pud), page_table_check_clear(mm, addr, pud_pfn(pud),
PUD_PAGE_SIZE >> PAGE_SHIFT); PUD_SIZE >> PAGE_SHIFT);
} }
} }
EXPORT_SYMBOL(__page_table_check_pud_clear); EXPORT_SYMBOL(__page_table_check_pud_clear);
...@@ -223,7 +223,7 @@ void __page_table_check_pmd_set(struct mm_struct *mm, unsigned long addr, ...@@ -223,7 +223,7 @@ void __page_table_check_pmd_set(struct mm_struct *mm, unsigned long addr,
__page_table_check_pmd_clear(mm, addr, *pmdp); __page_table_check_pmd_clear(mm, addr, *pmdp);
if (pmd_user_accessible_page(pmd)) { if (pmd_user_accessible_page(pmd)) {
page_table_check_set(mm, addr, pmd_pfn(pmd), page_table_check_set(mm, addr, pmd_pfn(pmd),
PMD_PAGE_SIZE >> PAGE_SHIFT, PMD_SIZE >> PAGE_SHIFT,
pmd_write(pmd)); pmd_write(pmd));
} }
} }
...@@ -238,7 +238,7 @@ void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr, ...@@ -238,7 +238,7 @@ void __page_table_check_pud_set(struct mm_struct *mm, unsigned long addr,
__page_table_check_pud_clear(mm, addr, *pudp); __page_table_check_pud_clear(mm, addr, *pudp);
if (pud_user_accessible_page(pud)) { if (pud_user_accessible_page(pud)) {
page_table_check_set(mm, addr, pud_pfn(pud), page_table_check_set(mm, addr, pud_pfn(pud),
PUD_PAGE_SIZE >> PAGE_SHIFT, PUD_SIZE >> PAGE_SHIFT,
pud_write(pud)); pud_write(pud));
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册