linux/arch/powerpc
Christophe Leroy ad91f66f5f powerpc/fsl_book3e: Don't set rodata RO too early
On fsl_book3e, rodata is set read-only at the same time as
init text is set NX at the end of init. That's too early.

As both action are performed at the same time, delay both
actions to the time rodata is expected to be made read-only.

It means we will have a small window with init mem freed but
still executable. It shouldn't be an issue though, especially
because the said memory gets poisoned and should therefore
result to a bad instruction fault in case it gets executed.

mmu_mark_initmem_nx() is bailing out before doing anything when
CONFIG_STRICT_KERNEL_RWX is not selected or rodata_enabled is false.

mmu_mark_rodata_ro() is called only when CONFIG_STRICT_KERNEL_RWX
is selected and rodata_enabled is true so this is equivalent.

Move code from mmu_mark_initmem_nx() into mmu_mark_rodata_ro() and
remove the call to strict_kernel_rwx_enabled() which is not needed
anymore.

Fixes: d5970045cf ("powerpc/fsl_booke: Update of TLBCAMs after init")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/2e35f0fd649c83c5add17a99514ac040767be93a.1652981047.git.christophe.leroy@csgroup.eu
2022-05-22 15:59:54 +10:00
..
boot powerpc/microwatt: Add mmu bits to device tree 2022-05-22 15:59:54 +10:00
configs arch: Remove references to CONFIG_NFSD_V3 in the default configs 2022-03-11 10:25:16 -05:00
crypto powerpc: fix typos in comments 2022-05-05 22:12:44 +10:00
include powerpc: Enable the DAWR on POWER9 DD2.3 and above 2022-05-22 15:59:53 +10:00
kernel powerpc: Enable the DAWR on POWER9 DD2.3 and above 2022-05-22 15:59:53 +10:00
kexec powerpc/kasan: Disable address sanitization in kexec paths 2022-05-22 15:58:29 +10:00
kvm powerpc: Fix all occurences of "the the" 2022-05-22 15:59:43 +10:00
lib powerpc/kasan: Don't instrument non-maskable or raw interrupts 2022-05-22 15:58:29 +10:00
math-emu powerpc/64s: avoid reloading (H)SRR registers if they are still valid 2021-06-25 00:06:55 +10:00
mm powerpc/fsl_book3e: Don't set rodata RO too early 2022-05-22 15:59:54 +10:00
net powerpc/inst: Remove PPC_INST_BL 2022-05-22 15:58:27 +10:00
perf powerpc/perf: Fix the threshold compare group constraint for power9 2022-05-22 15:58:30 +10:00
platforms powerpc/powernv/flash: Check OPAL flash calls exist before using 2022-05-22 15:59:54 +10:00
purgatory powerpc/kexec: Don't use .machine ppc64 in trampoline_64.S 2021-04-08 21:17:43 +10:00
sysdev powerpc/iommu: Add missing of_node_put in iommu_init_early_dart 2022-05-22 15:58:31 +10:00
tools powerpc/64: Add UADDR64 relocation support 2022-03-09 21:47:53 +11:00
xmon powerpc: Fix all occurences of "the the" 2022-05-22 15:59:43 +10:00
Kbuild kbuild: use more subdir- for visiting subdirectories while cleaning 2021-10-24 13:49:46 +09:00
Kconfig powerpc: Book3S 64-bit outline-only KASAN support 2022-05-22 15:58:29 +10:00
Kconfig.debug powerpc: Book3S 64-bit outline-only KASAN support 2022-05-22 15:58:29 +10:00
Makefile powerpc: Finalise cleanup around ABI use 2022-05-19 23:11:29 +10:00
Makefile.postlink