diff options
author | Christophe Leroy <christophe.leroy@csgroup.eu> | 2020-08-05 17:27:28 +0200 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2020-08-18 05:40:15 +0200 |
commit | 7bee31ad8e2f6c276f36993346ac70f4d4c80e45 (patch) | |
tree | fc49fadc33ddb769f483e246c4b6f6e80b46e7a0 /arch/powerpc | |
parent | powerpc/kasan: Fix KASAN_SHADOW_START on BOOK3S_32 (diff) | |
download | linux-7bee31ad8e2f6c276f36993346ac70f4d4c80e45.tar.xz linux-7bee31ad8e2f6c276f36993346ac70f4d4c80e45.zip |
powerpc/32s: Fix is_module_segment() when MODULES_VADDR is defined
When MODULES_VADDR is defined, is_module_segment() shall check the
address against it instead of checking agains VMALLOC_START.
Fixes: 6ca055322da8 ("powerpc/32s: Use dedicated segment for modules with STRICT_KERNEL_RWX")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/07884ed033c31e074747b7eb8eaa329d15db07ec.1596641219.git.christophe.leroy@csgroup.eu
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/mm/book3s32/mmu.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/powerpc/mm/book3s32/mmu.c b/arch/powerpc/mm/book3s32/mmu.c index c0162911f6cb..82ae9e06a773 100644 --- a/arch/powerpc/mm/book3s32/mmu.c +++ b/arch/powerpc/mm/book3s32/mmu.c @@ -191,10 +191,17 @@ static bool is_module_segment(unsigned long addr) { if (!IS_ENABLED(CONFIG_MODULES)) return false; +#ifdef MODULES_VADDR + if (addr < ALIGN_DOWN(MODULES_VADDR, SZ_256M)) + return false; + if (addr >= ALIGN(MODULES_END, SZ_256M)) + return false; +#else if (addr < ALIGN_DOWN(VMALLOC_START, SZ_256M)) return false; if (addr >= ALIGN(VMALLOC_END, SZ_256M)) return false; +#endif return true; } |