Thread (65 messages) 65 messages, 12 authors, 2023-07-17

Re: [PATCH v2 10/12] arch: make execmem setup available regardless of CONFIG_MODULES

From: Song Liu <song@kernel.org>
Date: 2023-06-16 20:18:17
Also in: bpf, linux-arm-kernel, linux-mips, linux-mm, linux-modules, linux-riscv, linux-s390, linuxppc-dev, lkml, loongarch, netdev, sparclinux

On Fri, Jun 16, 2023 at 1:52 AM Mike Rapoport [off-list ref] wrote:
From: "Mike Rapoport (IBM)" <rppt@kernel.org>

execmem does not depend on modules, on the contrary modules use
execmem.

To make execmem available when CONFIG_MODULES=n, for instance for
kprobes, split execmem_params initialization out from
arch/kernel/module.c and compile it when CONFIG_EXECMEM=y

Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
---
[...]
+
+struct execmem_params __init *execmem_arch_params(void)
+{
+       u64 module_alloc_end;
+
+       kaslr_init();
Aha, this addresses my comment on the earlier patch. Thanks!

Acked-by: Song Liu <song@kernel.org>

+
+       module_alloc_end = module_alloc_base + MODULES_VSIZE;
+
+       execmem_params.modules.text.pgprot = PAGE_KERNEL;
+       execmem_params.modules.text.start = module_alloc_base;
+       execmem_params.modules.text.end = module_alloc_end;
+
+       execmem_params.jit.text.pgprot = PAGE_KERNEL_ROX;
[...]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help