Re: [PATCH v3 02/13] mm: introduce execmem_text_alloc() and execmem_free()

From: Mike Rapoport
Date: Sat Sep 23 2023 - 11:39:07 EST


On Thu, Sep 21, 2023 at 03:34:18PM -0700, Song Liu wrote:
> On Mon, Sep 18, 2023 at 12:30 AM Mike Rapoport <rppt@xxxxxxxxxx> wrote:
> >
>
> [...]
>
> > diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
> > index 42215f9404af..db5561d0c233 100644
> > --- a/arch/s390/kernel/module.c
> > +++ b/arch/s390/kernel/module.c
> > @@ -21,6 +21,7 @@
> > #include <linux/moduleloader.h>
> > #include <linux/bug.h>
> > #include <linux/memory.h>
> > +#include <linux/execmem.h>
> > #include <asm/alternative.h>
> > #include <asm/nospec-branch.h>
> > #include <asm/facility.h>
> > @@ -76,7 +77,7 @@ void *module_alloc(unsigned long size)
> > #ifdef CONFIG_FUNCTION_TRACER
> > void module_arch_cleanup(struct module *mod)
> > {
> > - module_memfree(mod->arch.trampolines_start);
> > + execmem_free(mod->arch.trampolines_start);
> > }
> > #endif
> >
> > @@ -510,7 +511,7 @@ static int module_alloc_ftrace_hotpatch_trampolines(struct module *me,
> >
> > size = FTRACE_HOTPATCH_TRAMPOLINES_SIZE(s->sh_size);
> > numpages = DIV_ROUND_UP(size, PAGE_SIZE);
> > - start = module_alloc(numpages * PAGE_SIZE);
> > + start = execmem_text_alloc(EXECMEM_FTRACE, numpages * PAGE_SIZE);
>
> This should be EXECMEM_MODULE_TEXT?

This is an ftrace trampoline, so I think it should be FTRACE type of
allocation.

> Thanks,
> Song
>
> > if (!start)
> > return -ENOMEM;
> > set_memory_rox((unsigned long)start, numpages);
> [...]

--
Sincerely yours,
Mike.