This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [Bug runtime/14026] inode based uprobes print_ubacktrace doesn't resolve the symbol name
- From: Srikar Dronamraju <srikar at linux dot vnet dot ibm dot com>
- To: Mark Wielaard <mjw at redhat dot com>
- Cc: Frank Ch Eigler <fche at redhat dot com>, systemtap at sourceware dot org
- Date: Mon, 23 Jul 2012 15:04:30 +0530
- Subject: Re: [Bug runtime/14026] inode based uprobes print_ubacktrace doesn't resolve the symbol name
- References: <bug-14026-6586@http.sourceware.org/bugzilla/> <bug-14026-6586-ZhCR7938Kv@http.sourceware.org/bugzilla/> <20120723055706.GB4874@linux.vnet.ibm.com> <1343031967.30850.28.camel@springer.wildebeest.org>
- Reply-to: Srikar Dronamraju <srikar at linux dot vnet dot ibm dot com>
* Mark Wielaard <mjw@redhat.com> [2012-07-23 10:26:07]:
> On Mon, 2012-07-23 at 11:27 +0530, Srikar Dronamraju wrote:
> > > --- Comment #24 from Frank Ch. Eigler <fche at redhat dot com> 2012-07-19 14:53:23 UTC ---
> > > This inode-uprobes shortcoming is biting other users too. Perhaps we can work
> > > around it in stap land by using the mmap callbacks that check build-ids to also
> > > go and calculate run-time virtual addresses of the inode-uprobes, so they can
> > > be filled in around probe execution time.
> > >
> >
> > Can you please elaborate on whats the shortcoming?
>
> The issue is that probe handlers (and various parts of the systemtap
> runtime) assume they have access to the exact REG_IP where the program
> was probed. At least on x86 architectures there is an off-by-one because
> the IP is increased before the probe handler is called. This results in
> the probe handler (and unwinder) not knowing exactly where they are. In
> some cases that leads to errors since the IP spilled over into the next
> function (in which case the runtime cannot find the correct CFI).
>
> With kprobes and utrace-uprobes tapsets.cxx works around this by doing
> the following:
>
> // 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->uregs);";
> s.op->newline() << "SET_REG_IP(regs, inst->vaddr);";
> s.op->newline() << "(*sups->probe->ph) (c);";
> s.op->newline() << "SET_REG_IP(regs, uprobes_ip);";
> s.op->newline(-1) << "}";
>
> We need something similar for inode-uprobes, because currently it has:
>
> // XXX: Can't set SET_REG_IP; we don't actually know the relocated address.
> // ... In some error cases, uprobes itself calls uprobes_get_bkpt_addr().
>
uprobes_get_bkpt_addr() [ which is now called uprobe_get_swbp_addr ]
will only return the virtual address where a probe is placed (which is
probably what you are looking for). uprobe_get_swbp_addr() never
sets/resets IP. However its not a static function but its not exported
too.
The other option would be have something similar to
uprobe_get_swbp_addr() within stap. Including uprobes.h would
necessarily mean that UPROBE_SWBP_INSN_SIZE is always set.
But it means we have to depend on UPROBE_SWBP_INSN_SIZE.
May the later option is not all that nice.
--
Thanks and regards
Srikar