powerpc/fsl_book3e: Don't set rodata RO too early
Guenter Roeck
Tested-byQuoted 10 lines · Christophe Leroy
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 executer.
executed
Quoted 7 lines
mmu_mark_initmem_nx()is bailing out before doing anything whenCONFIG_STRICT_KERNEL_RWXis not selected orrodata_enabledis false.
mmu_mark_rodata_ro()is called only whenCONFIG_STRICT_KERNEL_RWXis selected androdata_enabledis true so this is equivalent.
Quoted 7 lines
Move code from
mmu_mark_initmem_nx()intommu_mark_rodata_ro()and remove the call tostrict_kernel_rwx_enabled()which is not needed anymore.Reported-by Guenter Roeck <[email protected]>Fixes d5970045cf9e ("powerpc/fsl_booke: Update of TLBCAMs after init")Signed-off-by Christophe Leroy <[email protected]>
Guenter