aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/kprobes.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-08-26 17:38:30 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2009-08-26 20:33:03 -0400
commit24851d2447830e6cba4c4b641cb73e713f312373 (patch)
treeb0aa315fc67b3aedab3bd84ef99ea3d933fd365c /arch/x86/kernel/kprobes.c
parent30a7e073b590ebd1829a906164b0a637e77cc967 (diff)
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 'arch/x86/kernel/kprobes.c')
-rw-r--r--arch/x86/kernel/kprobes.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index 16ae9610f6f..ecee3d23fef 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -490,9 +490,13 @@ static int __kprobes reenter_kprobe(struct kprobe *p, struct pt_regs *regs,
490 /* A probe has been hit in the codepath leading up 490 /* A probe has been hit in the codepath leading up
491 * to, or just after, single-stepping of a probed 491 * to, or just after, single-stepping of a probed
492 * instruction. This entire codepath should strictly 492 * instruction. This entire codepath should strictly
493 * reside in .kprobes.text section. Raise a warning 493 * reside in .kprobes.text section.
494 * to highlight this peculiar case. 494 * Raise a BUG or we'll continue in an endless
495 * reentering loop and eventually a stack overflow.
495 */ 496 */
497 arch_disarm_kprobe(p);
498 dump_kprobe(p);
499 BUG();
496 } 500 }
497 default: 501 default:
498 /* impossible cases */ 502 /* impossible cases */