Skip to content

Support page table check PowerPC

Rohan McLure linux-arm-kernel linux-mm linux-riscv linuxppc-dev 7 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v12 Latest11 patches 14 repliesIn review
  2. v1111 patches 8 repliesSuperseded
  3. v1012 patches 6 repliesSuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v97 patches7 repliesSuperseded
v87 patches3 repliesSuperseded
v77 patches5 repliesSuperseded
v67 patches5 repliesSuperseded

Changes in v12 from the cover letter

* Rename commits that revert changes to instead reflect that we are reinstating old behaviour due to it providing more flexibility
* Add return line to pud_pfn() stub
* Instrument ptep_get_and_clear() for nohash

Patches in v12 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_set()arch/arm64/include/asm/pgtable.h arch/riscv/include/asm/pgtable.h arch/x86/include/asm/pgtable.h +2 more+12 -81 reply
2/11mm/page_table_check: Reinstate address parameter in [__]page_table_check_pmd_set()arch/arm64/include/asm/pgtable.h arch/riscv/include/asm/pgtable.h arch/x86/include/asm/pgtable.h +2 more+15 -111 reply
3/11mm/page_table_check: Provide addr parameter to page_table_check_pte_set()arch/arm64/include/asm/pgtable.h arch/riscv/include/asm/pgtable.h include/linux/page_table_check.h +2 more+12 -101 reply
4/11mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_clear()arch/x86/include/asm/pgtable.h include/linux/page_table_check.h include/linux/pgtable.h +1 more+12 -81 reply
5/11mm/page_table_check: Reinstate address parameter in [__]page_table_check_pmd_clear()arch/arm64/include/asm/pgtable.h arch/riscv/include/asm/pgtable.h arch/x86/include/asm/pgtable.h +3 more+14 -101 reply
6/11mm/page_table_check: Reinstate address parameter in [__]page_table_check_pte_clear()arch/arm64/include/asm/pgtable.h arch/riscv/include/asm/pgtable.h arch/x86/include/asm/pgtable.h +3 more+16 -121 reply
7/11mm: Provide address parameter to p{te,md,ud}_user_accessible_page()arch/arm64/include/asm/pgtable.h arch/riscv/include/asm/pgtable.h arch/x86/include/asm/pgtable.h +1 more+15 -151 reply
8/11powerpc: mm: Add pud_pfn() stubarch/powerpc/include/asm/pgtable.h+9 -01 reply
9/11poweprc: mm: Implement *_user_accessible_page() for ptesarch/powerpc/include/asm/book3s/32/pgtable.h arch/powerpc/include/asm/book3s/64/pgtable.h arch/powerpc/include/asm/nohash/pgtable.h +1 more+35 -01 reply
10/11powerpc: mm: Use set_pte_at_unchecked() for early-boot / internal usagesarch/powerpc/include/asm/pgtable.h arch/powerpc/mm/book3s64/hash_pgtable.c arch/powerpc/mm/book3s64/pgtable.c +4 more+20 -101 reply
11/11powerpc: mm: Support page table checkarch/powerpc/Kconfig arch/powerpc/include/asm/book3s/32/pgtable.h arch/powerpc/include/asm/book3s/64/pgtable.h +5 more+68 -151 reply

Reviews trailers per patch

10 of 11 patches have a Reviewed-by or Acked-by.

PatchChristophe LeroyPasha Tatashin
1/11R-b
2/11R-b
3/11R-b
4/11R-b
5/11R-b
6/11R-b
7/11R-b
8/11R-b
9/11R-b
10/11
11/11R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v12 thread

Cover letter [PATCH v12 00/11] Support page table check PowerPC

Support page table check on all PowerPC platforms. This works by serialising assignments, reassignments and clears of page table entries at each level in order to ensure that anonymous mappings have at most one writable consumer, and likewise that file-backed mappings are not simultaneously also anonymous mappings.

In order to support this infrastructure, a number of stubs must be defined for all powerpc platforms. Additionally, seperate set_pte_at() and set_pte_at_unchecked(), to allow for internal, uninstrumented mappings.

v12:
* Rename commits that revert changes to instead reflect that we are reinstating old behaviour due to it providing more flexibility
* Add return line to pud_pfn() stub
* Instrument ptep_get_and_clear() for nohash

v11:
* The pud_pfn() stub, which previously had no legitimate users on any powerpc platform, now has users in Book3s64 with transparent pages. Include a stub of the same name for each platform that does not define their own.
* Drop patch that standardised use of p*d_leaf(), as already included upstream in v6.9.
* Provide fallback definitions of p{m,u}d_user_accessible_page() that do not reference p*d_leaf(), p*d_pte(), as they are defined after powerpc/mm headers by linux/mm headers.
* Ensure that set_pte_at_unchecked() has the same checks as set_pte_at().

v10:
* Revert patches that removed address and mm parameters from page table check routines, including consuming code from arm64, x86_64 and riscv.
* Implement *_user_accessible_page() routines in terms of pte_user() where available (64-bit, book3s) but otherwise by checking the address (on platforms where the pte does not imply whether the mapping is for user or kernel)
* Internal set_pte_at() calls replaced with set_pte_at_unchecked(), which is identical, but prevents double instrumentation.

v9:
* Adapt to using the set_ptes() API, using __set_pte_at() where we need must avoid instrumentation.
* Use the logic of *_access_permitted() for implementing *_user_accessible_page(), which are required routines for page table check.
* Even though we no longer need p{m,u,4}d_leaf(), still default implement these to assist in refactoring out extant p{m,u,4}_is_leaf().
* Add p{m,u}_pte() stubs where asm-generic does not provide them, as page table check wants all *user_accessible_page() variants, and we would like to default implement the variants in terms of pte_user_accessible_page().
* Avoid the ugly pmdp_collapse_flush() macro nonsense! Just instrument its constituent calls instead for radix and hash.

v8:
* Fix linux/page_table_check.h include in asm/pgtable.h breaking 32-bit.

v7:
* Remove use of extern in set_pte prototypes
* Clean up pmdp_collapse_flush macro
* Replace set_pte_at with static inline function
* Fix commit message for patch 7

v6:
* Support huge pages and p{m,u}d accounting.
* Remove instrumentation from set_pte from kernel internal pages.
* 64s: Implement pmdp_collapse_flush in terms of __pmdp_collapse_flush as access to the mm_struct * is required.

v5:

Rohan McLure (11):
mm/page_table_check: Reinstate address parameter in

    [__]page_table_check_pud_set()
  mm/page_table_check: Reinstate address parameter in
    [__]page_table_check_pmd_set()
  mm/page_table_check: Provide addr parameter to
    page_table_check_pte_set()
  mm/page_table_check: Reinstate address parameter in
    [__]page_table_check_pud_clear()
  mm/page_table_check: Reinstate address parameter in
    [__]page_table_check_pmd_clear()
  mm/page_table_check: Reinstate address parameter in
    [__]page_table_check_pte_clear()

mm: Provide address parameter to p{te,md,ud}_user_accessible_page()
powerpc: mm: Add pud_pfn() stub
poweprc: mm: Implement *_user_accessible_page() for ptes
powerpc: mm: Use set_pte_at_unchecked() for early-boot / internal
usages
powerpc: mm: Support page table check

 arch/arm64/include/asm/pgtable.h             | 18 +++---
 arch/powerpc/Kconfig                         |  1 +
 arch/powerpc/include/asm/book3s/32/pgtable.h | 12 +++-
 arch/powerpc/include/asm/book3s/64/pgtable.h | 62 +++++++++++++++---
 arch/powerpc/include/asm/nohash/pgtable.h    | 13 +++-
 arch/powerpc/include/asm/pgtable.h           | 19 ++++++
 arch/powerpc/mm/book3s64/hash_pgtable.c      |  6 +-
 arch/powerpc/mm/book3s64/pgtable.c           | 17 +++--
 arch/powerpc/mm/book3s64/radix_pgtable.c     | 11 ++--
 arch/powerpc/mm/nohash/book3e_pgtable.c      |  2 +-
 arch/powerpc/mm/pgtable.c                    | 12 ++++
 arch/powerpc/mm/pgtable_32.c                 |  2 +-
 arch/riscv/include/asm/pgtable.h             | 18 +++---
 arch/x86/include/asm/pgtable.h               | 20 +++---
 include/linux/page_table_check.h             | 67 ++++++++++++--------
 include/linux/pgtable.h                      |  8 +--
 mm/page_table_check.c                        | 39 +++++++-----
 17 files changed, 228 insertions(+), 99 deletions(-)
Signature · 1 line
2.44.0