]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dtrace: allocate space for SDT trampolines using module_alloc
authorKris Van Hees <kris.van.hees@oracle.com>
Thu, 4 Jun 2015 20:17:43 +0000 (16:17 -0400)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 21 Jul 2015 14:30:14 +0000 (15:30 +0100)
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 <kris.van.hees@oracle.com>
Acked-by: Nick Alcock <nick.alcock@oracle.com>
Acked-by: Allen Pais <allen.pais@oracle.com>
arch/sparc/kernel/module.c

index 192a617a32f3cfd192cd76b484e3cc853e58cba2..4bbb0eae20702d4eaf0c65e95aee90001ab53bd4 100644 (file)
@@ -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 */