summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include/asm/mmu.h
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@c-s.fr>2019-02-21 20:08:45 +0100
committerMichael Ellerman <mpe@ellerman.id.au>2019-02-23 11:04:32 +0100
commit28ea38b9cba68eec55cf550acd6b36b6f507cd17 (patch)
tree186162e391d432a3533eef89d52bde400593236f /arch/powerpc/include/asm/mmu.h
parentpowerpc/32: add helper to write into segment registers (diff)
downloadlinux-28ea38b9cba68eec55cf550acd6b36b6f507cd17.tar.xz
linux-28ea38b9cba68eec55cf550acd6b36b6f507cd17.zip
powerpc/mmu: add is_strict_kernel_rwx() helper
Add a helper to know whether STRICT_KERNEL_RWX is enabled. This is based on rodata_enabled flag which is defined only when CONFIG_STRICT_KERNEL_RWX is selected. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/include/asm/mmu.h')
-rw-r--r--arch/powerpc/include/asm/mmu.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index 6d22a8e78fe2..d34ad1657d7b 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -289,6 +289,17 @@ static inline u16 get_mm_addr_key(struct mm_struct *mm, unsigned long address)
}
#endif /* CONFIG_PPC_MEM_KEYS */
+#ifdef CONFIG_STRICT_KERNEL_RWX
+static inline bool strict_kernel_rwx_enabled(void)
+{
+ return rodata_enabled;
+}
+#else
+static inline bool strict_kernel_rwx_enabled(void)
+{
+ return false;
+}
+#endif
#endif /* !__ASSEMBLY__ */
/* The kernel use the constants below to index in the page sizes array.