summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfche <fche>2005-11-04 21:46:14 +0000
committerfche <fche>2005-11-04 21:46:14 +0000
commit1472a4e17771f9076a7aa83c8cd2f4a1364a9a94 (patch)
treecc1617c76917678f7e1c622cb9894e84f490a9d5
parentf7ad9b0424f404afa659108980065c24aaa5e3e4 (diff)
downloadsystemtap-steved-1472a4e17771f9076a7aa83c8cd2f4a1364a9a94.tar.gz
systemtap-steved-1472a4e17771f9076a7aa83c8cd2f4a1364a9a94.tar.xz
systemtap-steved-1472a4e17771f9076a7aa83c8cd2f4a1364a9a94.zip
2005-11-04 Frank Ch. Eigler <fche@redhat.com>
* tapsets.cxx (dwarf_derived_probe::emit_registrations): Add possible kprobe address prechecking logic. Set kretprobes maxactive to zero. * translate.cxx (emit_module_init): Set a more helpful default probe_point value for use in registration errors. Exit properly after registration failure of probe #0.
-rw-r--r--ChangeLog9
-rw-r--r--tapsets.cxx17
-rw-r--r--translate.cxx10
3 files changed, 31 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 46621e75..490c14ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-11-04 Frank Ch. Eigler <fche@redhat.com>
+
+ * tapsets.cxx (dwarf_derived_probe::emit_registrations): Add
+ possible kprobe address prechecking logic. Set kretprobes
+ maxactive to zero.
+ * translate.cxx (emit_module_init): Set a more helpful default
+ probe_point value for use in registration errors. Exit properly
+ after registration failure of probe #0.
+
2005-11-04 Roland McGrath <roland@redhat.com>
* tapsets.cxx (add_probe_point): Use dwfl_module_relocation_info to
diff --git a/tapsets.cxx b/tapsets.cxx
index 8345c797..0e4357e7 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -2601,14 +2601,25 @@ dwarf_derived_probe::emit_registrations (translator_output* o,
o->indent(1);
string probe_name = struct_kprobe_array_name(probenum) + "[i]";
+#if 0
+ // XXX: triggers false negatives on RHEL4U2 kernel
+ // emit address verification code
+ o->newline() << "void *addr = " << probe_name;
+ if (has_return)
+ o->line() << ".kp.addr;";
+ else
+ o->line() << ".addr;";
+ o->newline() << "rc = ! virt_addr_valid (addr);";
+#endif
+
if (has_return)
{
o->newline() << "#ifdef ARCH_SUPPORTS_KRETPROBES";
o->newline() << probe_name << ".handler = &" << func_name << ";";
- o->newline() << probe_name << ".maxactive = 1;";
+ o->newline() << probe_name << ".maxactive = 0;"; // request default
// XXX: pending PR 1289
// o->newline() << probe_name << ".kp_fault_handler = &stap_kprobe_fault_handler;";
- o->newline() << "rc = register_kretprobe (&(" << probe_name << "));";
+ o->newline() << "rc = rc || register_kretprobe (&(" << probe_name << "));";
o->newline() << "#else";
o->newline() << "rc = 1;";
o->newline() << "#endif";
@@ -2618,7 +2629,7 @@ dwarf_derived_probe::emit_registrations (translator_output* o,
o->newline() << probe_name << ".pre_handler = &" << func_name << ";";
// XXX: pending PR 1289
// o->newline() << probe_name << ".kp_fault_handler = &stap_kprobe_fault_handler;";
- o->newline() << "rc = register_kprobe (&(" << probe_name << "));";
+ o->newline() << "rc = rc || register_kprobe (&(" << probe_name << "));";
}
o->newline() << "if (unlikely (rc)) {";
diff --git a/translate.cxx b/translate.cxx
index bdacdcca..0c1ce84f 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -825,9 +825,13 @@ c_unparser::emit_module_init ()
{
o->newline() << "/* register probe #" << i << ", ";
o->line() << session->probes[i]->locations.size() << " location(s) */";
- // default
+
+ // By default, mark the first location as the site of possible
+ // registration failure. This is helpful since non-dwarf
+ // derived_probes tend to have only a single location.
+ assert (session->probes[i]->locations.size() > 0);
o->newline() << "probe_point = " <<
- lex_cast_qstring (*session->probes[i]->tok) << ";";
+ lex_cast_qstring (*session->probes[i]->locations[0]) << ";";
session->probes[i]->emit_registrations (o, i);
o->newline() << "if (unlikely (rc)) {";
@@ -843,6 +847,8 @@ c_unparser::emit_module_init ()
// essential for kprobes.
if (i > 0)
o->newline() << "goto unregister_" << (i-1) << ";";
+ else
+ o->newline() << "goto out;";
o->newline(-1) << "}";
}