]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
powerpc/32: Remove PAGE_KERNEL_TEXT to fix startup failure
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Tue, 9 Sep 2025 10:03:49 +0000 (12:03 +0200)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Tue, 16 Sep 2025 10:46:00 +0000 (16:16 +0530)
commit9316512b717f6f25c4649b3fdb0a905b6a318e9f
tree4fbbab2694704e213657717f8d462bd5e98a24a2
parent7cec88bfdd33434d62d4d5ba664127fa175b50e7
powerpc/32: Remove PAGE_KERNEL_TEXT to fix startup failure

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
arch/powerpc/include/asm/pgtable.h
arch/powerpc/mm/book3s32/mmu.c
arch/powerpc/mm/pgtable_32.c