Commit 28ea38b9 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

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: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 02d5d13b
...@@ -289,6 +289,17 @@ static inline u16 get_mm_addr_key(struct mm_struct *mm, unsigned long address) ...@@ -289,6 +289,17 @@ static inline u16 get_mm_addr_key(struct mm_struct *mm, unsigned long address)
} }
#endif /* CONFIG_PPC_MEM_KEYS */ #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__ */ #endif /* !__ASSEMBLY__ */
/* The kernel use the constants below to index in the page sizes array. /* The kernel use the constants below to index in the page sizes array.
......
...@@ -108,12 +108,10 @@ static void __init MMU_setup(void) ...@@ -108,12 +108,10 @@ static void __init MMU_setup(void)
__map_without_bats = 1; __map_without_bats = 1;
__map_without_ltlbs = 1; __map_without_ltlbs = 1;
} }
#ifdef CONFIG_STRICT_KERNEL_RWX if (strict_kernel_rwx_enabled()) {
if (rodata_enabled) {
__map_without_bats = 1; __map_without_bats = 1;
__map_without_ltlbs = 1; __map_without_ltlbs = 1;
} }
#endif
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment