Commit 7bee31ad authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

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: 6ca05532 ("powerpc/32s: Use dedicated segment for modules with STRICT_KERNEL_RWX")
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/07884ed033c31e074747b7eb8eaa329d15db07ec.1596641219.git.christophe.leroy@csgroup.eu
parent 48d2f040
...@@ -191,10 +191,17 @@ static bool is_module_segment(unsigned long addr) ...@@ -191,10 +191,17 @@ static bool is_module_segment(unsigned long addr)
{ {
if (!IS_ENABLED(CONFIG_MODULES)) if (!IS_ENABLED(CONFIG_MODULES))
return false; 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)) if (addr < ALIGN_DOWN(VMALLOC_START, SZ_256M))
return false; return false;
if (addr >= ALIGN(VMALLOC_END, SZ_256M)) if (addr >= ALIGN(VMALLOC_END, SZ_256M))
return false; return false;
#endif
return true; return true;
} }
......
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