linux/arch/powerpc/mm
Christophe Leroy 3739560a7d powerpc/32: Remove PAGE_KERNEL_TEXT to fix startup failure
[ Upstream commit 9316512b71 ]

PAGE_KERNEL_TEXT is an old macro that is used to tell kernel whether
kernel text has to be mapped read-only or read-write based on build
time options.

But nowadays, with functionnalities like jump_labels, static links,
etc ... more only less all kernels need to be read-write at some
point, and some combinations of configs failed to work due to
innacurate setting of PAGE_KERNEL_TEXT. On the other hand, today
we have CONFIG_STRICT_KERNEL_RWX which implements a more controlled
access to kernel modifications.

Instead of trying to keep PAGE_KERNEL_TEXT accurate with all
possible options that may imply kernel text modification, always
set kernel text read-write at startup and rely on
CONFIG_STRICT_KERNEL_RWX to provide accurate protection.

Do this by passing PAGE_KERNEL_X to map_kernel_page() in
__maping_ram_chunk() instead of passing PAGE_KERNEL_TEXT. Once
this is done, the only remaining user of PAGE_KERNEL_TEXT is
mmu_mark_initmem_nx() which uses it in a call to setibat().
As setibat() ignores the RW/RO, we can seamlessly replace
PAGE_KERNEL_TEXT by PAGE_KERNEL_X here as well and get rid of
PAGE_KERNEL_TEXT completely.

Reported-by: Erhard Furtner <erhard_f@mailbox.org>
Closes: https://lore.kernel.org/all/342b4120-911c-4723-82ec-d8c9b03a8aef@mailbox.org/
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Tested-by: Andrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/8e2d793abf87ae3efb8f6dce10f974ac0eda61b8.1757412205.git.christophe.leroy@csgroup.eu
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-10-29 14:10:17 +01:00
..
book3s32 powerpc/32: Remove PAGE_KERNEL_TEXT to fix startup failure 2025-10-29 14:10:17 +01:00
book3s64 Summary of significant series in this pull request: 2025-07-31 14:57:54 -07:00
kasan mm/memblock: add memblock_alloc_or_panic interface 2025-01-25 20:22:38 -08:00
nohash Add a new optional ",cma" suffix to the crashkernel= command line option 2025-07-19 19:08:22 -07:00
ptdump mm/ptdump: split note_page() into level specific callbacks 2025-05-11 17:48:19 -07:00
cacheflush.c powerpc: Fix typos 2024-05-08 00:21:30 +10:00
copro_fault.c cxl: Remove driver 2025-03-16 22:04:27 +11:00
dma-noncoherent.c dma-mapping: merge <linux/dma-noncoherent.h> into <linux/dma-map-ops.h> 2020-10-06 07:07:06 +02:00
drmem.c powerpc/mm/drmem: Silence drmem_init() early return 2024-06-04 17:13:56 +10:00
fault.c powerpc/mm/fault: Use str_write_read() helper function 2025-05-15 10:00:28 +05:30
hugetlbpage.c mm/hugetlb: add pre-HVO framework 2025-03-16 22:06:29 -07:00
init-common.c book3s64/radix: Refactoring common kfence related functions 2024-10-23 18:53:20 +11:00
init_32.c powerpc: Untangle fixmap.h and pgtable.h and mmu.h 2023-10-19 17:12:44 +11:00
init_64.c mm/bootmem_info: export register_page_bootmem_memmap 2025-03-16 22:06:27 -07:00
ioremap.c - The 6 patch series "Enable strict percpu address space checks" from 2025-04-01 09:29:18 -07:00
ioremap_32.c powerpc: mm: convert to GENERIC_IOREMAP 2023-08-18 10:12:35 -07:00
ioremap_64.c powerpc/io: Remove PCI_FIX_ADDR 2025-02-26 21:15:08 +05:30
maccess.c powerpc/inst: Optimise copy_inst_from_kernel_nofault() 2021-12-09 22:41:21 +11:00
Makefile mm: rename GENERIC_PTDUMP and PTDUMP_CORE 2025-03-17 00:05:32 -07:00
mem.c - The 7 patch series "powerpc/crash: use generic crashkernel 2025-04-01 10:06:52 -07:00
mmu_context.c powerpc/4xx: Remove CONFIG_BOOKE_OR_40x 2024-06-28 22:28:48 +10:00
mmu_decl.h powerpc: Remove core support for 40x 2024-06-28 22:28:47 +10:00
numa.c powerpc/pseries/iommu: memory notifier incorrectly adds TCEs for pmemory 2025-02-11 11:39:10 +05:30
pageattr.c powerpc: Don't ignore errors from set_memory_{n}p() in __kernel_map_pages() 2024-03-03 22:18:45 +11:00
pgtable-frag.c powerpc: mm: call ctor/dtor for kernel PTEs 2025-05-11 17:48:22 -07:00
pgtable.c powerpc: remove checks for devmap pages and PMDs/PUDs 2025-07-09 22:42:17 -07:00
pgtable_32.c powerpc/32: Remove PAGE_KERNEL_TEXT to fix startup failure 2025-10-29 14:10:17 +01:00
pgtable_64.c mm/treewide: replace pXd_huge() with pXd_leaf() 2024-04-25 20:55:46 -07:00