[PATCH] powerpc/32s: Fix is_module_segment() when MODULES_VADDR is defined

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE2184d LANDED

Landed in mainline as 7bee31ad8e2f on 2020-08-18.

2 messages, 2 authors, 2020-08-18 · open the first message on its own page

[PATCH] powerpc/32s: Fix is_module_segment() when MODULES_VADDR is defined

From: Christophe Leroy <hidden>
Date: 2020-08-05 20:15:05

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 <redacted>
---
 arch/powerpc/mm/book3s32/mmu.c | 7 +++++++
 1 file changed, 7 insertions(+)
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;
 }
 
-- 
2.25.0

Re: [PATCH] powerpc/32s: Fix is_module_segment() when MODULES_VADDR is defined

From: Michael Ellerman <hidden>
Date: 2020-08-18 13:58:32

On Wed, 5 Aug 2020 15:27:28 +0000 (UTC), Christophe Leroy wrote:
When MODULES_VADDR is defined, is_module_segment() shall check the
address against it instead of checking agains VMALLOC_START.
Applied to powerpc/fixes.

[1/1] powerpc/32s: Fix is_module_segment() when MODULES_VADDR is defined
      https://git.kernel.org/powerpc/c/7bee31ad8e2f6c276f36993346ac70f4d4c80e45

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help