LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>,
	mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: Re: [RFC 0/4] tracing,x86_64 - function/graph trace without mcount/-pg/framepointer
Date: Thu, 03 Feb 2011 14:00:28 -0500	[thread overview]
Message-ID: <1296759628.10797.96.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <20110203173543.GA1769@nowhere>

On Thu, 2011-02-03 at 18:35 +0100, Frederic Weisbecker wrote:

> > ftrace could do that now, but it would require a separate handler. I
> > would need to disable preemption before calling the module code function
> > handler.
> 
> Kprobes takes care of handlers from modules already.
> I'm not sure we want that, it makes the tracing code more sensitive.

Masami,

I'm looking at the optimize code, particularly
kprobes_optinsn_template_holder(), which looks to be the template that
is called on optimized kprobes. I don't see where preemption or
interrupts are disabled when a probe is called.

If modules can register probes, and we can call it in any arbitrary
location of the kernel, then preemption must be disabled prior to
calling the module code. Otherwise you risk crashing the system on
module unload.


module:
-------
register_kprobe(probe);


Core:
-----
hit break point
call probe

      module:
      -------
      in probe function
      preempted

module:
-------
unregister_kprobe(probe);
stop_machine();
<module unloaded>

Core:
-----
      module <zombie>:
      ----------------
      gets CPU again
      executes module code that's been freed
      DEATH BY ZOMBIES

Maybe I missed something. But does the optimize kprobes disable
preemption or interrupts before calling the optimized probe?

-- Steve



  reply	other threads:[~2011-02-03 19:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-03 15:42 Jiri Olsa
2011-02-03 15:42 ` [PATCH 1/4] kprobe - ktrace instruction slot cache interface Jiri Olsa
2011-02-03 15:42 ` [PATCH 2/4] tracing - adding size parameter to do_ftrace_mod_code Jiri Olsa
2011-02-03 15:42 ` [PATCH 3/4] ktrace - function trace support Jiri Olsa
2011-02-03 15:42 ` [PATCH 4/4] ktrace - function graph " Jiri Olsa
2011-02-03 16:33 ` [RFC 0/4] tracing,x86_64 - function/graph trace without mcount/-pg/framepointer Steven Rostedt
2011-02-03 17:35   ` Frederic Weisbecker
2011-02-03 19:00     ` Steven Rostedt [this message]
2011-02-04  6:03 ` Masami Hiramatsu
2011-02-07 21:22 Josh Triplett
2011-02-07 21:32 ` Steven Rostedt

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=1296759628.10797.96.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@elte.hu \
    --subject='Re: [RFC 0/4] tracing,x86_64 - function/graph trace without mcount/-pg/framepointer' \
    /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

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 NNTP newsgroup(s).