diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2017-07-14 16:51:23 +1000 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2017-07-18 19:54:24 +1000 |
commit | 029d9252b116fa52a95150819e62af1f6e420fe5 (patch) | |
tree | 6f7832ca67de31a117dbb1b3346bfae3ec1a348e /arch/powerpc/include/asm/book3s/64/radix.h | |
parent | fa7f9189e017213bad63b93a76de5c715cd62a96 (diff) | |
download | lwn-029d9252b116fa52a95150819e62af1f6e420fe5.tar.gz lwn-029d9252b116fa52a95150819e62af1f6e420fe5.zip |
powerpc/mm: Mark __init memory no-execute when STRICT_KERNEL_RWX=y
Currently even with STRICT_KERNEL_RWX we leave the __init text marked
executable after init, which is bad.
Add a hook to mark it NX (no-execute) before we free it, and implement
it for radix and hash.
Note that we use __init_end as the end address, not _einittext,
because overlaps_kernel_text() uses __init_end, because there are
additional executable sections other than .init.text between
__init_begin and __init_end.
Tested on radix and hash with:
0:mon> p $__init_begin
*** 400 exception occurred
Fixes: 1e0fc9d1eb2b ("powerpc/Kconfig: Enable STRICT_KERNEL_RWX for some configs")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/include/asm/book3s/64/radix.h')
-rw-r--r-- | arch/powerpc/include/asm/book3s/64/radix.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/book3s/64/radix.h b/arch/powerpc/include/asm/book3s/64/radix.h index 487709ff6875..544440b5aff3 100644 --- a/arch/powerpc/include/asm/book3s/64/radix.h +++ b/arch/powerpc/include/asm/book3s/64/radix.h @@ -118,6 +118,7 @@ #ifdef CONFIG_STRICT_KERNEL_RWX extern void radix__mark_rodata_ro(void); +extern void radix__mark_initmem_nx(void); #endif static inline unsigned long __radix_pte_update(pte_t *ptep, unsigned long clr, |