powerpc/32s: Define a MODULE area below kernel text all the time
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Thu, 1 Apr 2021 13:30:43 +0000 (13:30 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 14 Apr 2021 13:04:13 +0000 (23:04 +1000)
On book3s/32, the segment below kernel text is used for module
allocation when CONFIG_STRICT_KERNEL_RWX is defined.

In order to benefit from the powerpc specific module_alloc()
function which allocate modules with 32 Mbytes from
end of kernel text, use that segment below PAGE_OFFSET at all time.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/a46dcdd39a9e80b012d86c294c4e5cd8d31665f3.1617283827.git.christophe.leroy@csgroup.eu
arch/powerpc/Kconfig
arch/powerpc/include/asm/book3s/32/pgtable.h
arch/powerpc/mm/book3s32/mmu.c

index 36d7c56df91d81ebd6495ac4a7681e397f73b8e3..7c5c72cbf19f0cdc74d888dfd9974aa9ad06809a 100644 (file)
@@ -1220,7 +1220,7 @@ config TASK_SIZE_BOOL
 config TASK_SIZE
        hex "Size of user task space" if TASK_SIZE_BOOL
        default "0x80000000" if PPC_8xx
-       default "0xb0000000" if PPC_BOOK3S_32 && STRICT_KERNEL_RWX
+       default "0xb0000000" if PPC_BOOK3S_32
        default "0xc0000000"
 endmenu
 
index 415ae29fa73a2f6f9d81f7fcea07642d29aaa6dc..83c65845a1a9d6062d8c916b8bb17627b1d5452a 100644 (file)
@@ -194,10 +194,8 @@ int map_kernel_page(unsigned long va, phys_addr_t pa, pgprot_t prot);
 #define VMALLOC_END    ioremap_bot
 #endif
 
-#ifdef CONFIG_STRICT_KERNEL_RWX
 #define MODULES_END    ALIGN_DOWN(PAGE_OFFSET, SZ_256M)
 #define MODULES_VADDR  (MODULES_END - SZ_256M)
-#endif
 
 #ifndef __ASSEMBLY__
 #include <linux/sched.h>
index a0db398b5c265879a019178b8b63c458ff5fb02c..159930351d9f960b456279beaffa45ce7418a84d 100644 (file)
@@ -184,17 +184,10 @@ 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) - 1)
                return false;
-#else
-       if (addr < ALIGN_DOWN(VMALLOC_START, SZ_256M))
-               return false;
-       if (addr > ALIGN(VMALLOC_END, SZ_256M) - 1)
-               return false;
-#endif
        return true;
 }