[PW_SID:975583] Support page table check on PowerPC#573
[PW_SID:975583] Support page table check on PowerPC#573linux-riscv-bot wants to merge 13 commits into
Conversation
To provide support for page table check on powerpc, we need to reinstate the
address parameter in several functions, including
page_table_check_{ptes,pmds,puds}_set().
In preparation for this, add the addr parameter to arm64's __set_ptes_anysz()
and its callers, __set_ptes(), __set_pmds() and __set_puds(). While this
parameter won't (at present) be used on arm64, this will keep the usage of
the page table check interfaces consistent.
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
To provide support for page table check on powerpc, we need to reinstate the
address parameter in several functions, including
page_table_check_{pte,pmd,pud}_clear().
In preparation for this, add the addr parameter to arm64's
__ptep_get_and_clear_anysz() and change its callsites accordingly. While this
parameter won't (at present) be used on arm64, this will keep the usage of
the page table check interfaces consistent.
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…eck_pud[s]_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. Apply this to __page_table_check_puds_set(), page_table_check_puds_set() and the page_table_check_pud_set() wrapper macro. [ajd@linux.ibm.com: rebase on riscv + arm64 changes, update commit message] Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com> Acked-by: Ingo Molnar <mingo@kernel.org> # x86 Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…eck_pmd[s]_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. Apply this to __page_table_check_pmds_set(), page_table_check_pmd_set(), and the page_table_check_pmd_set() wrapper macro. [ajd@linux.ibm.com: rebase on arm64 + riscv changes, update commit message] Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com> Acked-by: Ingo Molnar <mingo@kernel.org> # x86 Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…tes_set() To provide support for powerpc platforms, provide an addr parameter to the __page_table_check_ptes_set() and page_table_check_ptes_set() routines. 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 from the addr parameter. [ajd@linux.ibm.com: rebase on arm64 + riscv changes, update commit message] 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_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. [ajd@linux.ibm.com: rebase on arm64 changes] Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com> Acked-by: Ingo Molnar <mingo@kernel.org> # x86 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. [ajd@linux.ibm.com: rebase on arm64 changes] Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com> Acked-by: Ingo Molnar <mingo@kernel.org> # x86 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. [ajd@linux.ibm.com: rebase, fix additional occurrence and loop handling] Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com> Acked-by: Ingo Molnar <mingo@kernel.org> # x86 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. [ajd@linux.ibm.com: rebase on arm64 changes] Signed-off-by: Rohan McLure <rmclure@linux.ibm.com> Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com> Acked-by: Ingo Molnar <mingo@kernel.org> # x86 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. On powerpc, only book3s64 platforms allow for hugepages at this upper level, and thus only book3s64 currently defines pud_pfn(). The page table check code that calls pud_pfn() is gated by a call to pud_user_accessible_page(), which will always return false on any platform other than book3s64. Add a stub implementation of pud_pfn() for all platforms other than book3s64. As it will never actually be used and should always be compiled out, raise a BUILD_BUG() error. [ajd@linux.ibm.com: clarify commit message] 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.
[ajd@linux.ibm.com: rebase and fix commit message]
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>
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.
[ajd@linux.ibm.com: don't change to unchecked for early boot/kernel mappings]
Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
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") [ajd@linux.ibm.com: rebase] 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> Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[v15,01/13] arm64/mm: Add addr parameter to _set{ptes_anysz,ptes,pmds,puds}()" |
|
Patch 1: "[v15,01/13] arm64/mm: Add addr parameter to _set{ptes_anysz,ptes,pmds,puds}()" |
|
Patch 1: "[v15,01/13] arm64/mm: Add addr parameter to _set{ptes_anysz,ptes,pmds,puds}()" |
|
Patch 1: "[v15,01/13] arm64/mm: Add addr parameter to _set{ptes_anysz,ptes,pmds,puds}()" |
|
Patch 1: "[v15,01/13] arm64/mm: Add addr parameter to _set{ptes_anysz,ptes,pmds,puds}()" |
|
Patch 1: "[v15,01/13] arm64/mm: Add addr parameter to _set{ptes_anysz,ptes,pmds,puds}()" |
|
Patch 1: "[v15,01/13] arm64/mm: Add addr parameter to _set{ptes_anysz,ptes,pmds,puds}()" |
|
Patch 1: "[v15,01/13] arm64/mm: Add addr parameter to _set{ptes_anysz,ptes,pmds,puds}()" |
|
Patch 1: "[v15,01/13] arm64/mm: Add addr parameter to _set{ptes_anysz,ptes,pmds,puds}()" |
|
Patch 1: "[v15,01/13] arm64/mm: Add addr parameter to _set{ptes_anysz,ptes,pmds,puds}()" |
|
Patch 1: "[v15,01/13] arm64/mm: Add addr parameter to _set{ptes_anysz,ptes,pmds,puds}()" |
|
Patch 1: "[v15,01/13] arm64/mm: Add addr parameter to _set{ptes_anysz,ptes,pmds,puds}()" |
|
Patch 2: "[v15,02/13] arm64/mm: Add addr parameter to __ptep_get_and_clear_anysz()" |
|
Patch 2: "[v15,02/13] arm64/mm: Add addr parameter to __ptep_get_and_clear_anysz()" |
|
Patch 2: "[v15,02/13] arm64/mm: Add addr parameter to __ptep_get_and_clear_anysz()" |
|
Patch 2: "[v15,02/13] arm64/mm: Add addr parameter to __ptep_get_and_clear_anysz()" |
|
Patch 2: "[v15,02/13] arm64/mm: Add addr parameter to __ptep_get_and_clear_anysz()" |
|
Patch 11: "[v15,11/13] powerpc: mm: Implement *_user_accessible_page() for ptes" |
|
Patch 11: "[v15,11/13] powerpc: mm: Implement *_user_accessible_page() for ptes" |
|
Patch 11: "[v15,11/13] powerpc: mm: Implement *_user_accessible_page() for ptes" |
|
Patch 11: "[v15,11/13] powerpc: mm: Implement *_user_accessible_page() for ptes" |
|
Patch 11: "[v15,11/13] powerpc: mm: Implement *_user_accessible_page() for ptes" |
|
Patch 11: "[v15,11/13] powerpc: mm: Implement *_user_accessible_page() for ptes" |
|
Patch 12: "[v15,12/13] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 12: "[v15,12/13] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 12: "[v15,12/13] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 12: "[v15,12/13] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 12: "[v15,12/13] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 12: "[v15,12/13] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 12: "[v15,12/13] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 12: "[v15,12/13] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 12: "[v15,12/13] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 12: "[v15,12/13] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 12: "[v15,12/13] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 12: "[v15,12/13] powerpc: mm: Use set_pte_at_unchecked() for internal usages" |
|
Patch 13: "[v15,13/13] powerpc: mm: Support page table check" |
|
Patch 13: "[v15,13/13] powerpc: mm: Support page table check" |
|
Patch 13: "[v15,13/13] powerpc: mm: Support page table check" |
|
Patch 13: "[v15,13/13] powerpc: mm: Support page table check" |
|
Patch 13: "[v15,13/13] powerpc: mm: Support page table check" |
|
Patch 13: "[v15,13/13] powerpc: mm: Support page table check" |
|
Patch 13: "[v15,13/13] powerpc: mm: Support page table check" |
|
Patch 13: "[v15,13/13] powerpc: mm: Support page table check" |
|
Patch 13: "[v15,13/13] powerpc: mm: Support page table check" |
|
Patch 13: "[v15,13/13] powerpc: mm: Support page table check" |
|
Patch 13: "[v15,13/13] powerpc: mm: Support page table check" |
|
Patch 13: "[v15,13/13] powerpc: mm: Support page table check" |
PR for series 975583 applied to workflow__riscv__fixes
Name: Support page table check on PowerPC
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=975583
Version: 15