From aadd712bb77a1c7b4753eb2fbb665195e3d674ed Mon Sep 17 00:00:00 2001 From: Kris Van Hees Date: Thu, 4 Jun 2015 16:17:43 -0400 Subject: [PATCH] dtrace: allocate space for SDT trampolines using module_alloc The allocation of the SDT trampolines was done previously using vmalloc which may cause the trampolines to be too far away from the code that they provide a call to dtrace_probe() for, making it impossible to put a jump to the trampoline in a single instruction at the probe location. By using module_alloc on SPARC, the trampolines are allocated in the memory region where modules live, which is by design within the jump range. The allocated memory is known to be of sufficient size for trampolines, yet its actual use is not determined at the kernel level. It is simply provided as a chunk of memory in the appropriate range. Orabug: 21220344 Signed-off-by: Kris Van Hees Acked-by: Nick Alcock Acked-by: Allen Pais --- arch/sparc/kernel/module.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c index 192a617a32f3..4bbb0eae2070 100644 --- a/arch/sparc/kernel/module.c +++ b/arch/sparc/kernel/module.c @@ -222,6 +222,18 @@ int module_finalize(const Elf_Ehdr *hdr, __asm__ __volatile__("flush %g6"); } +#ifdef CONFIG_DTRACE + me->pdata = module_alloc(me->sdt_probec * SDT_TRAMP_SIZE * + sizeof(sdt_instr_t)); +#endif + return 0; } + +#ifdef CONFIG_DTRACE +void module_arch_cleanup(struct module *me) +{ + module_free(me->pdata); +} +#endif #endif /* CONFIG_SPARC64 */ -- 2.50.1