From 129de9ef18cd142e31ed509a7704d4faf0879f4c Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 3 Jun 2009 15:36:03 +0200 Subject: Detect kretprobe trampoline and use fallback unwinder. * runtime/sym.h (_stp_kretprobe_trampoline): Document. * translate.cxx (unwindsym_dump_context): Add stp_kretprobe_trampoline_addr. (dump_unwindsyms): Detect kretprobe_trampoline_holder symbol address. (emit_symbol_data): Initialize and emit _stp_kretprobe_trampoline. * runtime/transport/symbols.c (_stp_do_relocation): Detect kernel load address and adjust _stp_kretprobe_trampoline. * runtime/stack-i386.c (__stp_stack_print): Always use fallback unwinder when hitting kretprobe_trampoline_holder. * runtime/stack-x86_64.c (__stp_stack_print): Likewise. --- runtime/transport/symbols.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'runtime/transport/symbols.c') diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c index a329effe..3e6a2fb1 100644 --- a/runtime/transport/symbols.c +++ b/runtime/transport/symbols.c @@ -30,6 +30,14 @@ static void _stp_do_relocation(const char __user *buf, size_t count) dbug_sym(2, "relocate (%s %s 0x%lx)\n", msg.module, msg.reloc, (unsigned long) msg.address); + /* Detect actual kernel load address. */ + if (!strcmp ("kernel", msg.module) + && !strcmp ("_stext", msg.reloc)) { + dbug_sym(2, "found kernel _stext load address: 0x%lx\n", + (unsigned long) msg.address); + if (_stp_kretprobe_trampoline != (unsigned long) -1) + _stp_kretprobe_trampoline += (unsigned long) msg.address; + } /* Save the relocation value. XXX: While keeping the data here is fine for the kernel address space ("kernel" and "*.ko" modules), -- cgit