From af234c407dbab3e62994863272a63b612b0c8c63 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 10 Nov 2009 18:37:02 -0800 Subject: PR5916: Exploit kretprobe data storage area Since 2.6.25, kretprobes can carry a data packet to be filled in an entry_handler. This patch lets us store our implicitly-saved $target variables in .return probes in that data area. * tapset/kretprobe.stp: New get/set functions for kretprobe data. * translate.cxx (c_unparser::emit_common_header): Add context->pi_longs. * tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol_saved_return): Switch between the old and new methods of saving $vars in .return probes. (dwarf_var_expanding_visitor::gen_mapped_saved_return): The old way. (dwarf_var_expanding_visitor::gen_kretprobe_saved_return): The new way. (dwarf_derived_probe::join_group): Don't register paired entry-handlers. (dwarf_derived_probe::dwarf_derived_probe): Remember saved-var details. (dwarf_derived_probe_group::emit_module_decls): Output saved-var details. Also split the kretprobe handler whether we're on entry or return. (dwarf_derived_probe_group::emit_module_init): Prepare the entry handler. * testsuite/systemtap.base/kretprobe-vars.stp: Test implicit $var saving. --- translate.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'translate.cxx') diff --git a/translate.cxx b/translate.cxx index ed415abb..cbb8f1e3 100644 --- a/translate.cxx +++ b/translate.cxx @@ -892,6 +892,7 @@ c_unparser::emit_common_header () o->newline() << "unsigned long *unwaddr;"; // unwaddr is caching unwound address in each probe handler on ia64. o->newline() << "struct kretprobe_instance *pi;"; + o->newline() << "int pi_longs;"; // int64_t count in pi->data, the rest is string_t o->newline() << "int regparm;"; o->newline() << "va_list *mark_va_list;"; o->newline() << "const char * marker_name;"; -- cgit