Skip to content

mm: ptdump: Refactor CONFIG_DEBUG_WX and check_wx_pages debugfs attribute

Christophe Leroy linux-arm-kernel linux-mm linux-riscv linux-s390 linuxppc-dev lkml oe-kbuild-all 2 versions – Applied

Status from this message: [merged mm-stable] mm-ptdump-add-check_wx_pages-debugfs-attribute.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 1 replyApplied 5/5
  2. v14 patches 3 repliesSuperseded

Changes in v2 from the cover letter

- Fixed a few build failures (patch 1 and 2)
- Added patch 4
- Make the attribute return SUCCESS/FAILURE as suggested by Heiko (patch 5)

Patches in v2 All 5 applied

#Subject and filesSizeRepliesApplied
1/5arm: ptdump: Rename CONFIG_DEBUG_WX to CONFIG_ARM_DEBUG_WXarch/arm/Kconfig.debug arch/arm/configs/aspeed_g4_defconfig arch/arm/configs/aspeed_g5_defconfig +2 more+7 -70 repliesApplied
2/5arm64, powerpc, riscv, s390, x86: ptdump: Refactor CONFIG_DEBUG_WXarch/arm64/include/asm/ptdump.h arch/arm64/mm/mmu.c arch/powerpc/mm/mmu_decl.h +15 more+16 -711 replyApplied
3/5powerpc,s390: ptdump: Define ptdump_check_wx() regardless of CONFIG_DEBUG_WXarch/powerpc/mm/ptdump/ptdump.c arch/s390/mm/dump_pagetables.c+5 -90 repliesApplied
4/5mm: ptdump: Have ptdump_check_wx() return boolarch/arm64/mm/ptdump.c arch/powerpc/mm/ptdump/ptdump.c arch/riscv/mm/ptdump.c +4 more+48 -230 repliesApplied
5/5mm: ptdump: add check_wx_pages debugfs attributemm/ptdump.c+22 -00 repliesApplied

Reviews trailers per patch

1 of 5 patches has a Reviewed-by or Acked-by.

PatchAlexandre GhitiPalmer Dabbelt
1/5
2/5R-b A-b
3/5
4/5
5/5

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

Read the v2 thread

Cover letter [PATCH v2 0/5] mm: ptdump: Refactor CONFIG_DEBUG_WX and check_wx_pages debugfs attribute

Refer old discussion at https://lore.kernel.org/lkml/20200422152656.GF676@willie-the-truck/T/#m802eaf33efd6f8d575939d157301b35ac0d4a64f
And https://github.com/KSPP/linux/issues/35

This series refactors CONFIG_DEBUG_WX for the 5 architectures implementing CONFIG_GENERIC_PTDUMP

First rename stuff in ARM which uses similar names while not implementing CONFIG_GENERIC_PTDUMP.

Then define a generic version of debug_checkwx() that calls ptdump_check_wx() when CONFIG_DEBUG_WX is set. Call it immediately after calling mark_rodata_ro() instead of calling it at the end of every mark_rodata_ro().

Then implement a debugfs attribute that can be used to trigger a W^X test at anytime and regardless of CONFIG_DEBUG_WX

Changes in v2:
- Fixed a few build failures (patch 1 and 2)
- Added patch 4
- Make the attribute return SUCCESS/FAILURE as suggested by Heiko (patch 5)

Christophe Leroy (5):
arm: ptdump: Rename CONFIG_DEBUG_WX to CONFIG_ARM_DEBUG_WX arm64, powerpc, riscv, s390, x86: ptdump: Refactor CONFIG_DEBUG_WX powerpc,s390: ptdump: Define ptdump_check_wx() regardless of
CONFIG_DEBUG_WX
mm: ptdump: Have ptdump_check_wx() return bool
mm: ptdump: add check_wx_pages debugfs attribute

 arch/arm/Kconfig.debug               |  2 +-
 arch/arm/configs/aspeed_g4_defconfig |  2 +-
 arch/arm/configs/aspeed_g5_defconfig |  2 +-
 arch/arm/include/asm/ptdump.h        |  6 +++---
 arch/arm/mm/init.c                   |  2 +-
 arch/arm64/include/asm/ptdump.h      |  7 -------
 arch/arm64/mm/mmu.c                  |  2 --
 arch/arm64/mm/ptdump.c               | 11 ++++++++---
 arch/powerpc/mm/mmu_decl.h           |  6 ------
 arch/powerpc/mm/pgtable_32.c         |  4 ----
 arch/powerpc/mm/pgtable_64.c         |  3 ---
 arch/powerpc/mm/ptdump/ptdump.c      | 21 ++++++++++++++-------
 arch/riscv/include/asm/ptdump.h      | 22 ----------------------
 arch/riscv/mm/init.c                 |  3 ---
 arch/riscv/mm/ptdump.c               | 12 ++++++++----
 arch/s390/include/asm/ptdump.h       | 14 --------------
 arch/s390/mm/dump_pagetables.c       | 21 +++++++++++----------
 arch/s390/mm/init.c                  |  2 --
 arch/x86/include/asm/pgtable.h       |  5 ++---
 arch/x86/mm/dump_pagetables.c        | 20 ++++++++++++++------
 arch/x86/mm/init_32.c                |  2 --
 arch/x86/mm/init_64.c                |  2 --
 include/linux/ptdump.h               |  7 +++++++
 init/main.c                          |  2 ++
 mm/ptdump.c                          | 22 ++++++++++++++++++++++
 25 files changed, 95 insertions(+), 107 deletions(-)
 delete mode 100644 arch/riscv/include/asm/ptdump.h
 delete mode 100644 arch/s390/include/asm/ptdump.h
Signature · 1 line
2.43.0