summaryrefslogtreecommitdiffstats
path: root/kernel/kprobes.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-08-26 23:38:30 +0200
committerFrederic Weisbecker <fweisbec@gmail.com>2009-08-27 02:33:03 +0200
commit24851d2447830e6cba4c4b641cb73e713f312373 (patch)
treeb0aa315fc67b3aedab3bd84ef99ea3d933fd365c /kernel/kprobes.c
parent30a7e073b590ebd1829a906164b0a637e77cc967 (diff)
downloadlinux-24851d2447830e6cba4c4b641cb73e713f312373.tar.gz
linux-24851d2447830e6cba4c4b641cb73e713f312373.tar.bz2
linux-24851d2447830e6cba4c4b641cb73e713f312373.zip
tracing/kprobes: Dump the culprit kprobe in case of kprobe recursion
Kprobes can enter into a probing recursion, ie: a kprobe that does an endless loop because one of its core mechanism function used during probing is also probed itself. This patch helps pinpointing the kprobe that raised such recursion by dumping it and raising a BUG instead of a warning (we also disarm the kprobe to try avoiding recursion in BUG itself). Having a BUG instead of a warning stops the stacktrace in the right place and doesn't pollute the logs with hundreds of traces that eventually end up in a stack overflow. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Masami Hiramatsu <mhiramat@redhat.com> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Diffstat (limited to 'kernel/kprobes.c')
-rw-r--r--kernel/kprobes.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index ef177d653b2c..f72e96c25a38 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1141,6 +1141,13 @@ static void __kprobes kill_kprobe(struct kprobe *p)
arch_remove_kprobe(p);
}
+void __kprobes dump_kprobe(struct kprobe *kp)
+{
+ printk(KERN_WARNING "Dumping kprobe:\n");
+ printk(KERN_WARNING "Name: %s\nAddress: %p\nOffset: %x\n",
+ kp->symbol_name, kp->addr, kp->offset);
+}
+
/* Module notifier call back, checking kprobes on the module */
static int __kprobes kprobes_module_callback(struct notifier_block *nb,
unsigned long val, void *data)