Skip to content

Commit 541cebb

Browse files
chleroympe
authored andcommitted
powerpc/32s: Fix module loading failure when VMALLOC_END is over 0xf0000000
In is_module_segment(), when VMALLOC_END is over 0xf0000000, ALIGN(VMALLOC_END, SZ_256M) has value 0. In that case, addr >= ALIGN(VMALLOC_END, SZ_256M) is always true then is_module_segment() always returns false. Use (ALIGN(VMALLOC_END, SZ_256M) - 1) which will have value 0xffffffff and will be suitable for the comparison. Fixes: c496433 ("powerpc/32s: Only leave NX unset on segments used for modules") Reported-by: Andreas Schwab <[email protected]> Signed-off-by: Christophe Leroy <[email protected]> Tested-by: Andreas Schwab <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/09fc73fe9c7423c6b4cf93f93df9bb0ed8eefab5.1597994047.git.christophe.leroy@csgroup.eu
1 parent 90a9b10 commit 541cebb

File tree

1 file changed

+2
-2
lines changed
  • arch/powerpc/mm/book3s32

1 file changed

+2
-2
lines changed

arch/powerpc/mm/book3s32/mmu.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,12 @@ static bool is_module_segment(unsigned long addr)
194194
#ifdef MODULES_VADDR
195195
if (addr < ALIGN_DOWN(MODULES_VADDR, SZ_256M))
196196
return false;
197-
if (addr >= ALIGN(MODULES_END, SZ_256M))
197+
if (addr > ALIGN(MODULES_END, SZ_256M) - 1)
198198
return false;
199199
#else
200200
if (addr < ALIGN_DOWN(VMALLOC_START, SZ_256M))
201201
return false;
202-
if (addr >= ALIGN(VMALLOC_END, SZ_256M))
202+
if (addr > ALIGN(VMALLOC_END, SZ_256M) - 1)
203203
return false;
204204
#endif
205205
return true;

0 commit comments

Comments
 (0)