linux/arch/powerpc
Christophe Leroy 9bc631f952 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:08:53 +01:00
..
boot powerpc/boot: Fix build with gcc 15 2025-08-28 16:31:10 +02:00
configs arch: powerpc: defconfig: Drop obsolete CONFIG_NET_CLS_TCINDEX 2025-08-15 12:13:42 +02:00
crypto crypto: powerpc/poly1305 - add depends on BROKEN for now 2025-08-01 09:48:45 +01:00
include powerpc/32: Remove PAGE_KERNEL_TEXT to fix startup failure 2025-10-29 14:08:53 +01:00
kernel powerpc/8xx: Remove left-over instruction and comments in DataStoreTLBMiss handler 2025-10-15 11:59:54 +02:00
kexec powerpc/crash: Fix non-smp kexec preparation 2025-06-19 15:31:27 +02:00
kvm KVM: PPC: Enable CAP_SPAPR_TCE_VFIO on pSeries KVM guests 2025-04-20 10:15:54 +02:00
lib powerpc/code-patching: Fix KASAN hit by not flagging text patching area as VM_ALLOC 2025-02-27 04:30:16 -08:00
math-emu powerpc/math-emu: Inhibit W=1 warnings 2022-09-08 11:11:18 +10:00
mm powerpc/32: Remove PAGE_KERNEL_TEXT to fix startup failure 2025-10-29 14:08:53 +01:00
net powerpc updates for 6.11 2024-07-19 21:00:33 -07:00
perf arch/powerpc/perf: Check the instruction type before creating sample with perf_mem_data_src 2025-05-29 11:02:57 +02:00
platforms powerpc/pseries/msi: Fix potential underflow and leak issue 2025-10-19 16:33:52 +02:00
purgatory Makefile: remove redundant tool coverage variables 2024-05-14 23:35:48 +09:00
sysdev powerpc: Switch back to struct platform_driver::remove() 2024-09-10 11:27:40 +10:00
tools powerpc/tools: Pass -mabi=elfv2 to gcc-check-mprofile-kernel.sh 2023-10-20 17:46:33 +11:00
xmon powerpc/xmon: Fix tmpstr length check in scanhex 2024-08-27 17:10:55 +10:00
Kbuild powerpc: Fix fatal warnings flag for LLVM's integrated assembler 2024-04-08 16:06:41 +10:00
Kconfig powerpc: Fix stack protector Kconfig test for clang 2024-12-09 10:41:10 +01:00
Kconfig.debug powerpc/64s: Remove the "fast endian switch" syscall 2024-09-05 22:30:05 +10:00
Makefile powerpc: Adjust adding stack protector flags to KBUILD_CLAGS for clang 2024-12-09 10:41:10 +01:00
Makefile.postlink kbuild: remove ARCH_POSTLINK from module builds 2023-10-28 21:10:08 +09:00