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

From: Song Liu
Date: Fri Jun 16 2023 - 16:18:18 EST


On Fri, Jun 16, 2023 at 1:52 AM Mike Rapoport <rppt@xxxxxxxxxx> wrote:
>
> From: "Mike Rapoport (IBM)" <rppt@xxxxxxxxxx>
>
> 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@xxxxxxxxxx>
> ---
[...]
> +
> +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@xxxxxxxxxx>


> +
> + 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;
[...]