This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug uprobes/10458] uaddr() returns one past current instruction for uprobes
- From: "mjw at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sources dot redhat dot com
- Date: 30 Jul 2009 14:44:30 -0000
- Subject: [Bug uprobes/10458] uaddr() returns one past current instruction for uprobes
- References: <20090729111010.10458.mjw@redhat.com>
- Reply-to: sourceware-bugzilla at sourceware dot org
------- Additional Comments From mjw at redhat dot com 2009-07-30 14:44 -------
(In reply to comment #8)
> (In reply to comment #7)
> > Perhaps, but the runtime
>
> Indeed, think of the runtime!
>
> If this is always an issue for uprobes, why not just adjust it directly in
> enter_uprobe_probe?
That seems the easiest solution. I am testing the following patch which seems to
make things (for the testcase from #10454, except of course the last one without
debuginfo) just work as expected:
diff --git a/tapsets.cxx b/tapsets.cxx
index 2d68ddd..8dc76d7 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -4381,7 +4381,18 @@ uprobe_derived_probe_group::emit_module_decls
(systemtap_session& s)
s.op->newline() << "if (sup->spec_index < 0 ||"
<< "sup->spec_index >= " << probes.size() << ") return;"; //
XXX: should not happen
s.op->newline() << "c->regs = regs;";
+
+ // Make it look like the IP is set as it would in the actual user
+ // task when calling real probe handler. Reset IP regs on return, so
+ // we don't confuse uprobes. PR10458
+ s.op->newline() << "{";
+ s.op->indent(1);
+ s.op->newline() << "unsigned long uprobes_ip = REG_IP(c->regs);";
+ s.op->newline() << "REG_IP(regs) = inst->vaddr;";
s.op->newline() << "(*sups->ph) (c);";
+ s.op->newline() << "REG_IP(regs) = uprobes_ip;";
+ s.op->newline(-1) << "}";
+
common_probe_entryfn_epilogue (s.op);
s.op->newline(-1) << "}";
@@ -4393,7 +4404,18 @@ uprobe_derived_probe_group::emit_module_decls
(systemtap_session& s)
<< "sup->spec_index >= " << probes.size() << ") return;"; //
XXX: should not happen
// XXX: kretprobes saves "c->pi = inst;" too
s.op->newline() << "c->regs = regs;";
+
+ // Make it look like the IP is set as it would in the actual user
+ // task when calling real probe handler. Reset IP regs on return, so
+ // we don't confuse uprobes. PR10458
+ s.op->newline() << "{";
+ s.op->indent(1);
+ s.op->newline() << "unsigned long uprobes_ip = REG_IP(c->regs);";
+ s.op->newline() << "REG_IP(regs) = inst->rp->u.vaddr;";
s.op->newline() << "(*sups->ph) (c);";
+ s.op->newline() << "REG_IP(regs) = uprobes_ip;";
+ s.op->newline(-1) << "}";
+
common_probe_entryfn_epilogue (s.op);
s.op->newline(-1) << "}";
--
http://sourceware.org/bugzilla/show_bug.cgi?id=10458
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.