lkml.org 
[lkml]   [2020]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v5 2/6] vmalloc: Add text_alloc() and text_free()
    Date
    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.

    Cc: linux-mm@kvack.org
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Suggested-by: Peter Zijlstra <peterz@infradead.org>
    Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
    ---
    include/linux/vmalloc.h | 17 +++++++++++++++++
    1 file changed, 17 insertions(+)

    diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
    index 0221f852a7e1..6c151a0ac02a 100644
    --- a/include/linux/vmalloc.h
    +++ b/include/linux/vmalloc.h
    @@ -249,4 +249,21 @@ 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);

    +/*
    + * These functions can be optionally implemented by an arch in order to
    + * provide specialized functions for allocating trampoline code.
    + */
    +
    +#ifdef CONFIG_ARCH_HAS_TEXT_ALLOC
    +/*
    + * Allocate memory to be used for trampoline code.
    + */
    +void *text_alloc(unsigned long size);
    +
    +/*
    + * Free memory returned from text_alloc().
    + */
    +void text_free(void *region);
    +#endif /* CONFIG_ARCH_HAS_TEXT_ALLOC */
    +
    #endif /* _LINUX_VMALLOC_H */
    --
    2.25.1
    \
     
     \ /
      Last update: 2020-07-24 07:06    [W:5.432 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site