public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3][RFC] tracing/kprobes: prevent jprobes from crashing function graph tracer
@ 2009-10-29 20:51 Steven Rostedt
  2009-10-29 20:51 ` [PATCH 1/3][RFC] [PATCH 1/3] tracing: Clean up ftrace.h header and add ftrace_set_notrace() declaration Steven Rostedt
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Steven Rostedt @ 2009-10-29 20:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Masami Hiramatsu,
	Peter Zijlstra, Thomas Gleixner, Arnaldo Carvalho de Melo,
	H. Peter Anvin, Li Zefan, Lai Jiangshan, David S. Miller,
	Stephen Hemminger

Lately I've been testing with an allyesconfig. When I ran the function graph
tracer, it immediately crashed the kernel. Thanks to the new frame pointer
test in function graph, it reported directly what the issue was and then
panicked the kernel to prevent any unexpected damage from happening.

It pointed the error to be with jtcp_rcv_established. Which is a jprobe
function added to tcp_rcv_established at bootup when CONFIG_NET_TCPPROBE
is enabled.

Jprobes and the function graph tracer use the same mechanism to trace
the exit of a function. Unfortunately, only one can be done at a time.
The function graph tracer replaces the return address with its own handler,
but so does jprobes. The two are not compatible.

The solution I am proposing with this patch set is to add a call in
ftrace that lets other code in the kernel permanently disable functions from
being traced by the function and function graph tracer. As a probe function
is registered with jprobes, it calls this new function and that entry
will be removed from being traced.

I tested this with this patch series and it does solve the problem.

Some issues though:

1) this only works when DYNAMIC_FTRACE is enabled. We can prevent
function graph tracing with jprobes when DYNAMIC_FTRACE is not
enabled through Kconfig dependencies. Or have the registering of
a jprobe permanently disable function graph tracing.

2) This also prevents the function tracer from being able to trace a
function probe, even though the function tracer is not at issue
with this bug.

Feedback welcomed.

-- Steve

The following patches are in:

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git

    branch: rfc/trace


Steven Rostedt (3):
      tracing: Clean up ftrace.h header and add ftrace_set_notrace() declaration
      tracing: Add calls to permanently disable functions from tracing
      tracing/kprobes: Disable tracing registered jprobe callback functions

----
 include/linux/ftrace.h |   26 +++++++--
 kernel/kprobes.c       |    4 +
 kernel/trace/ftrace.c  |  147 +++++++++++++++++++++++++++++++++++++++++-------
 3 files changed, 150 insertions(+), 27 deletions(-)


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2009-11-02 20:31 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-29 20:51 [PATCH 0/3][RFC] tracing/kprobes: prevent jprobes from crashing function graph tracer Steven Rostedt
2009-10-29 20:51 ` [PATCH 1/3][RFC] [PATCH 1/3] tracing: Clean up ftrace.h header and add ftrace_set_notrace() declaration Steven Rostedt
2009-10-29 20:51 ` [PATCH 2/3][RFC] [PATCH 2/3] tracing: Add calls to permanently disable functions from tracing Steven Rostedt
2009-10-29 20:51 ` [PATCH 3/3][RFC] [PATCH 3/3] tracing/kprobes: Disable tracing registered jprobe callback functions Steven Rostedt
2009-10-29 22:02 ` [PATCH 0/3][RFC] tracing/kprobes: prevent jprobes from crashing function graph tracer Masami Hiramatsu
2009-10-29 22:17   ` Steven Rostedt
2009-10-29 22:26     ` Stephen Hemminger
2009-10-29 23:22     ` Masami Hiramatsu
2009-10-30  0:06       ` Steven Rostedt
2009-10-30  0:49         ` Masami Hiramatsu
2009-11-02  0:37   ` Frederic Weisbecker
2009-11-02 15:02     ` Masami Hiramatsu
2009-11-02 20:22       ` Frederic Weisbecker
2009-11-02 20:30         ` Masami Hiramatsu
2009-10-31 20:06 ` Frank Ch. Eigler
2009-11-01 14:48   ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox