public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
To: SystemTAP <systemtap@sources.redhat.com>
Subject: Breakpoints and queued signals
Date: Tue, 24 Jul 2007 11:56:00 -0000	[thread overview]
Message-ID: <20070724115549.GA4343@in.ibm.com> (raw)

Roland,

Here is a brief on what I saw happening on powerpc. The basic issue is
that a SIGTRAP caused due to a uprobes breakpoint, is being delivered
after the uprobe is unregistered, causing the application to terminate
with a "Trace/Breakpoint Trap".

The testcase being used is a simple program that calls a uprobed
function in a loop; simultaneously, the uprobe module is insmod/rmmod'ed
in a loop with a 0.5 second delay.

In the uprobes code, when a call to unregister happens, we wait for all
threads to rendezvous in the quiesce callback. One can get into the
quiesce callback for different reasons:
- A breakpoint (uprobe) hit, before the signal callback
- 'Cos the UTRACE_ACTION_QUIESCE was asserted for the thread to
  facilitate the breakpoint removal

In order to handle this, when a unregister is pending and a thread
enters quiesce, using regset calls, the PC is examined to determine if
it corresponds to a breakpoint. If not, we deem the quiesce entry to be
due to the QUIESCE flag assertion, or possibly a different SIGTRAP.

In the current issue, by some combination of events, we are getting into
the quiesce callback due to a SIGTRAP with the PC pointing to a libc
location. The SIGTRAP due to a uprobe breakpoint is the subsequent
one in the signal queue.

utrace_get_signal: pid = 3178, regs->nip = ff1a6d4, thread.regs->nip = ff1a6d4, signo = 0 <-- nip corresponds to the libc text area
utrace_get_signal: pid = 3178, regs->nip = 1000058c, thread.regs->nip =
1000058c, signo = 0 <-- this is the signal due to the uprobe

Hence, during unregister, since the PC obtained from regset doesn't
point to the uprobe breakpoint location, we just go ahead and unregister
the uprobe. The subsequent signal delivered though was caused by a
uprobe hit, but by this time, the handlers are long gone; the signal is
delivered to the application, leading to the process to terminate.

Is there a way to handle such cases, probably by "walking" the pending
signals list for the thread, during unregister? Or, do you think this
is a uprobes bug? Or, if this is just a by-product of the way signals
work, is it a realistic issue for other utrace clients also? If so, how
would you enviasge this be handled?

I must mention though that in recent tests, I haven't been able to
recreate this issue consistantly.

Thoughts?

Ananth

                 reply	other threads:[~2007-07-24 11:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20070724115549.GA4343@in.ibm.com \
    --to=ananth@in.ibm.com \
    --cc=systemtap@sources.redhat.com \
    /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).