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

Song Liu
2023-06-16T20:18:16Z

On Fri, Jun 16, 2023 at 1:52 AM Mike Rapoport <rppt@kernel.org> 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; …