lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Fri, 17 Jul 2020 17:52:45 +0900 From: Masami Hiramatsu <mhiramat@...nel.org> To: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com> Cc: linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>, Masami Hiramatsu <mhiramat@...nel.org>, Peter Zijlstra <peterz@...radead.org>, Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org (open list:MEMORY MANAGEMENT) Subject: Re: [PATCH v4 3/7] vmalloc: Add text_alloc() and text_free() On Fri, 17 Jul 2020 06:04:17 +0300 Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com> wrote: > Introduce functions for allocating memory for dynamic trampolines, such > as kprobes. An arch can promote the availability of these functions with > CONFIG_ARCH_HAS_TEXT_ALLOC. Provide default/fallback implementation > wrapping module_alloc() and module_memfree(). Doesn't it depend on CONFIG_MODULE? Thank you, > > Cc: Andi Kleen <ak@...ux.intel.com> > Cc: Masami Hiramatsu <mhiramat@...nel.org> > Suggested-by: Peter Zijlstra <peterz@...radead.org> > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com> > --- > include/linux/vmalloc.h | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h > index 0221f852a7e1..e981436e30b6 100644 > --- a/include/linux/vmalloc.h > +++ b/include/linux/vmalloc.h > @@ -9,6 +9,7 @@ > #include <asm/page.h> /* pgprot_t */ > #include <linux/rbtree.h> > #include <linux/overflow.h> > +#include <linux/moduleloader.h> > > #include <asm/vmalloc.h> > > @@ -249,4 +250,26 @@ pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms) > int register_vmap_purge_notifier(struct notifier_block *nb); > int unregister_vmap_purge_notifier(struct notifier_block *nb); > > +#ifdef CONFIG_ARCH_HAS_TEXT_ALLOC > +/* > + * Allocate memory to be used for dynamic trampoline code. > + */ > +void *text_alloc(unsigned long size); > + > +/* > + * Free memory returned from text_alloc(). > + */ > +void text_free(void *region); > +#else > +static inline void *text_alloc(unsigned long size) > +{ > + return module_alloc(size); > +} > + > +static inline void text_free(void *region) > +{ > + module_memfree(region); > +} > +#endif > + > #endif /* _LINUX_VMALLOC_H */ > -- > 2.25.1 > -- Masami Hiramatsu <mhiramat@...nel.org>
Powered by blists - more mailing lists