public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
To: Mark Wielaard <mjw@redhat.com>
Cc: Frank Ch Eigler <fche@redhat.com>, systemtap@sourceware.org
Subject: Re: [Bug runtime/14026] inode based uprobes print_ubacktrace doesn't resolve the symbol name
Date: Mon, 23 Jul 2012 09:35:00 -0000	[thread overview]
Message-ID: <20120723093430.GC4874@linux.vnet.ibm.com> (raw)
In-Reply-To: <1343031967.30850.28.camel@springer.wildebeest.org>

* 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

  reply	other threads:[~2012-07-23  9:35 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-27 10:00 [Bug runtime/14026] New: " adrian.m.negreanu at intel dot com
2012-04-27 10:02 ` [Bug runtime/14026] " adrian.m.negreanu at intel dot com
2012-04-27 10:03 ` adrian.m.negreanu at intel dot com
2012-04-27 13:51 ` adrian.m.negreanu at intel dot com
2012-04-27 13:57 ` mjw at redhat dot com
2012-04-27 15:23 ` adrian.m.negreanu at intel dot com
2012-04-27 15:39 ` adrian.m.negreanu at intel dot com
2012-05-02 13:22 ` adrian.m.negreanu at intel dot com
2012-05-02 14:06 ` mjw at redhat dot com
2012-05-02 14:30 ` adrian.m.negreanu at intel dot com
2012-05-02 14:33 ` adrian.m.negreanu at intel dot com
2012-05-02 14:44 ` adrian.m.negreanu at intel dot com
2012-05-02 14:49 ` mjw at redhat dot com
2012-05-02 15:34 ` mjw at redhat dot com
2012-05-02 15:38 ` mjw at redhat dot com
2012-05-02 19:56 ` mjw at redhat dot com
2012-05-03  9:55 ` mjw at redhat dot com
2012-05-04 13:11 ` adrian.m.negreanu at intel dot com
2012-05-04 13:51 ` adrian.m.negreanu at intel dot com
2012-05-06 12:43 ` mjw at redhat dot com
2012-05-06 12:44 ` mjw at redhat dot com
2012-05-06 12:45 ` mjw at redhat dot com
2012-05-06 12:46 ` mjw at redhat dot com
2012-05-06 12:47 ` mjw at redhat dot com
2012-05-06 12:47 ` mjw at redhat dot com
2012-05-06 12:48 ` mjw at redhat dot com
2012-05-06 13:09 ` mjw at redhat dot com
2012-05-06 19:39 ` mjw at redhat dot com
2012-05-06 21:16 ` fche at redhat dot com
2012-05-06 21:31 ` fche at redhat dot com
2012-05-07  8:43 ` mjw at redhat dot com
2012-05-07 13:45 ` [Bug runtime/14026] inode based uprobes " mjw at redhat dot com
2012-07-19 14:53 ` fche at redhat dot com
2012-07-23  5:57   ` Srikar Dronamraju
2012-07-23  8:26     ` Mark Wielaard
2012-07-23  9:35       ` Srikar Dronamraju [this message]
2012-07-19 20:56 ` [Bug runtime/14026] inode-uprobes should compute proper SET_REG_IP before probe invocation fche at redhat dot com
2012-07-26 22:09 ` fche at redhat dot com
2012-08-14 21:55 ` dsmith at redhat dot com
2012-08-14 22:10 ` dsmith at redhat dot com
2012-08-14 22:20 ` mjw at redhat dot com
2012-08-14 22:28 ` mjw at redhat dot com
2012-08-15 14:09 ` dsmith at redhat dot com
2012-08-15 14:14 ` dsmith at redhat dot com
2012-08-15 14:25 ` mjw at redhat dot com
2012-08-15 15:12 ` dsmith at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120723093430.GC4874@linux.vnet.ibm.com \
    --to=srikar@linux.vnet.ibm.com \
    --cc=fche@redhat.com \
    --cc=mjw@redhat.com \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).