[PATCH 04/13] mm/jitalloc, arch: convert remaining overrides of module_alloc to jitalloc
Song Liu
song at kernel.org
Thu Jun 1 15:35:47 PDT 2023
On Thu, Jun 1, 2023 at 3:13 AM Mike Rapoport <rppt at kernel.org> wrote:
>
> From: "Mike Rapoport (IBM)" <rppt at kernel.org>
>
> Extend jitalloc parameters to accommodate more complex overrides of
> module_alloc() by architectures.
>
> This includes specification of a fallback range required by arm, arm64
> and powerpc and support for allocation of KASAN shadow required by
> arm64, s390 and x86.
>
> The core implementation of jit_alloc() takes care of suppressing warnings
> when the initial allocation fails but there is a fallback range defined.
>
> Signed-off-by: Mike Rapoport (IBM) <rppt at kernel.org>
[...]
>
> diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c
> index 5af4975caeb5..ecf1f4030317 100644
> --- a/arch/arm64/kernel/module.c
> +++ b/arch/arm64/kernel/module.c
> @@ -17,56 +17,49 @@
> #include <linux/moduleloader.h>
> #include <linux/scs.h>
> #include <linux/vmalloc.h>
> +#include <linux/jitalloc.h>
> #include <asm/alternative.h>
> #include <asm/insn.h>
> #include <asm/scs.h>
> #include <asm/sections.h>
>
> -void *module_alloc(unsigned long size)
> +static struct jit_alloc_params jit_alloc_params = {
> + .alignment = MODULE_ALIGN,
> + .flags = JIT_ALLOC_KASAN_SHADOW,
> +};
> +
> +struct jit_alloc_params *jit_alloc_arch_params(void)
> {
> u64 module_alloc_end = module_alloc_base + MODULES_VSIZE;
module_alloc_base() is initialized in kaslr_init(), which is called after
mm_core_init(). We will need some special logic for this.
Thanks,
Song
> - gfp_t gfp_mask = GFP_KERNEL;
> - void *p;
> -
> - /* Silence the initial allocation */
> - if (IS_ENABLED(CONFIG_ARM64_MODULE_PLTS))
> - gfp_mask |= __GFP_NOWARN;
>
[...]
More information about the linux-riscv
mailing list