diff options
author | Christophe Leroy <christophe.leroy@csgroup.eu> | 2022-05-19 19:24:15 +0200 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2022-05-22 15:59:54 +1000 |
commit | ad91f66f5fa7c6f9346e721c3159ce818568028b (patch) | |
tree | 31432c44e5bcc9181a02d70ef16f10c371362434 /net | |
parent | 0ef1ffc7189521e293b4c5532659385dfddf8939 (diff) | |
download | linux-ad91f66f5fa7c6f9346e721c3159ce818568028b.tar.bz2 |
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: d5970045cf9e ("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
Diffstat (limited to 'net')
0 files changed, 0 insertions, 0 deletions