[PW_SID:952333] Support page table check on PowerPC#291
[PW_SID:952333] Support page table check on PowerPC#291linux-riscv-bot wants to merge 11 commits intoworkflow__riscv__fixesfrom
Conversation
…eck_pud_set() This reverts commit 6d14443 ("mm/page_table_check: remove unused parameter in [__]page_table_check_pud_set"). 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. Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com> [ajd: rebase on riscv changes, remove riscv commit message comment] Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…eck_pmd_set() This reverts commit a3b8371 ("mm/page_table_check: remove unused parameter in [__]page_table_check_pmd_set"). 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. Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com> [ajd: rebase on riscv and mm/page_table_check.c changes, remove riscv commit message comment] Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…et() To provide support for powerpc platforms, provide an addr parameter to the page_table_check_pte_set() routine. This parameter is needed on some powerpc platforms which do not encode whether a mapping is for user or kernel in the pte. On such platforms, this can be inferred form the addr parameter. Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com> [ajd: rebase] Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…eck_pud_clear() This reverts commit 931c38e ("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. Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com> Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…eck_pmd_clear() This reverts commit 1831414 ("mm/page_table_check: remove unused parameter in [__]page_table_check_pmd_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. Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com> Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…eck_pte_clear() This reverts commit aa23220 ("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. Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com> [ajd: rebase and fix additional occurrence] Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
On several powerpc platforms, a page table entry may not imply whether the relevant mapping is for userspace or kernelspace. Instead, such platforms infer this by the address which is being accessed. Add an additional address argument to each of these routines in order to provide support for page table check on powerpc. Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com> [ajd: rebase on arm64 changes] Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The page table check feature requires that pud_pfn() be defined on each consuming architecture. Since only 64-bit, Book3S platforms allow for hugepages at this upper level, and since the calling code is gated by a call to pud_user_accessible_page(), which will return zero, include this stub as a BUILD_BUG(). Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com> Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Page table checking depends on architectures providing an
implementation of p{te,md,ud}_user_accessible_page. With
refactorisations made on powerpc/mm, the pte_access_permitted() and
similar methods verify whether a userland page is accessible with the
required permissions.
Since page table checking is the only user of
p{te,md,ud}_user_accessible_page(), implement these for all platforms,
using some of the same preliminary checks taken by pte_access_permitted()
on that platform.
Since commit 8e9bd41 ("powerpc/nohash: Replace pte_user() by pte_read()")
pte_user() is no longer required to be present on all platforms as it
may be equivalent to or implied by pte_read(). Hence implementations of
pte_user_accessible_page() are specialised.
Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
[ajd: rebase and fix commit message]
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
In the new set_ptes() API, set_pte_at() (a special case of set_ptes())
is intended to be instrumented by the page table check facility. There
are however several other routines that constitute the API for setting
page table entries, including set_pmd_at() among others. Such routines
are themselves implemented in terms of set_ptes_at().
A future patch providing support for page table checking on powerpc
must take care to avoid duplicate calls to
page_table_check_p{te,md,ud}_set(). Allow for assignment of pte entries
without instrumentation through the set_pte_at_unchecked() routine
introduced in this patch.
Cause API-facing routines that call set_pte_at() to instead call
set_pte_at_unchecked(), which will remain uninstrumented by page
table check. set_ptes() is itself implemented by calls to
__set_pte_at(), so this eliminates redundant code.
Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
[ajd: don't change to unchecked for early boot/kernel mappings]
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
On creation and clearing of a page table mapping, instrument such calls by invoking page_table_check_pte_set and page_table_check_pte_clear respectively. These calls serve as a sanity check against illegal mappings. Enable ARCH_SUPPORTS_PAGE_TABLE_CHECK for all platforms. See also: riscv support in commit 3fee229 ("riscv/mm: enable ARCH_SUPPORTS_PAGE_TABLE_CHECK") arm64 in commit 42b2547 ("arm64/mm: enable ARCH_SUPPORTS_PAGE_TABLE_CHECK") x86_64 in commit d283d42 ("x86: mm: add x86_64 support for page table check") Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com> [ajd: rebase] Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[v14,01/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_set()" |
|
Patch 1: "[v14,01/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_set()" |
|
Patch 1: "[v14,01/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_set()" |
|
Patch 1: "[v14,01/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_set()" |
|
Patch 1: "[v14,01/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_set()" |
|
Patch 1: "[v14,01/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_set()" |
|
Patch 1: "[v14,01/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_set()" |
|
Patch 1: "[v14,01/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_set()" |
|
Patch 1: "[v14,01/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_set()" |
|
Patch 1: "[v14,01/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_set()" |
|
Patch 1: "[v14,01/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_set()" |
|
Patch 1: "[v14,01/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_set()" |
|
Patch 2: "[v14,02/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pmd_set()" |
|
Patch 2: "[v14,02/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pmd_set()" |
|
Patch 2: "[v14,02/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pmd_set()" |
|
Patch 2: "[v14,02/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pmd_set()" |
|
Patch 2: "[v14,02/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pmd_set()" |
|
Patch 2: "[v14,02/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pmd_set()" |
|
Patch 2: "[v14,02/11] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pmd_set()" |
|
Patch 9: "[v14,09/11] powerpc: mm: Implement *_user_accessible_page() for ptes" |
|
Patch 9: "[v14,09/11] powerpc: mm: Implement *_user_accessible_page() for ptes" |
|
Patch 9: "[v14,09/11] powerpc: mm: Implement *_user_accessible_page() for ptes" |
|
Patch 9: "[v14,09/11] powerpc: mm: Implement *_user_accessible_page() for ptes" |
|
Patch 10: "[v14,10/11] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 10: "[v14,10/11] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 10: "[v14,10/11] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 10: "[v14,10/11] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 10: "[v14,10/11] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 10: "[v14,10/11] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 10: "[v14,10/11] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 10: "[v14,10/11] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 10: "[v14,10/11] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 10: "[v14,10/11] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 10: "[v14,10/11] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 10: "[v14,10/11] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 11: "[v14,11/11] powerpc: mm: Support page table check" |
|
Patch 11: "[v14,11/11] powerpc: mm: Support page table check" |
|
Patch 11: "[v14,11/11] powerpc: mm: Support page table check" |
|
Patch 11: "[v14,11/11] powerpc: mm: Support page table check" |
|
Patch 11: "[v14,11/11] powerpc: mm: Support page table check" |
|
Patch 11: "[v14,11/11] powerpc: mm: Support page table check" |
|
Patch 11: "[v14,11/11] powerpc: mm: Support page table check" |
|
Patch 11: "[v14,11/11] powerpc: mm: Support page table check" |
|
Patch 11: "[v14,11/11] powerpc: mm: Support page table check" |
|
Patch 11: "[v14,11/11] powerpc: mm: Support page table check" |
|
Patch 11: "[v14,11/11] powerpc: mm: Support page table check" |
|
Patch 11: "[v14,11/11] powerpc: mm: Support page table check" |
PR for series 952333 applied to workflow__riscv__fixes
Name: Support page table check on PowerPC
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=952333
Version: 14