aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>2014-04-17 04:17:40 -0400
committerIngo Molnar <mingo@kernel.org>2014-04-24 04:03:00 -0400
commitecd50f714c421c759354632dd00f70c718c95b10 (patch)
tree82fc08180816ee1eb79e92a9060af1a25d1dd802 /arch/x86
parent6f6343f53d133bae516caf3d254bce37d8774625 (diff)
kprobes, x86: Call exception_enter after kprobes handled
Move exception_enter() call after kprobes handler is done. Since the exception_enter() involves many other functions (like printk), it can cause recursive int3/break loop when kprobes probe such functions. Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Reviewed-by: Steven Rostedt <rostedt@goodmis.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Borislav Petkov <bp@suse.de> Cc: Jiri Kosina <jkosina@suse.cz> Cc: Kees Cook <keescook@chromium.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Seiji Aguchi <seiji.aguchi@hds.com> Link: http://lkml.kernel.org/r/20140417081740.26341.10894.stgit@ltc230.yrl.intra.hitachi.co.jp Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/traps.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index e5d4a70814d7..ba9abe9cbce3 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -327,7 +327,6 @@ dotraplinkage void __kprobes notrace do_int3(struct pt_regs *regs, long error_co
327 if (poke_int3_handler(regs)) 327 if (poke_int3_handler(regs))
328 return; 328 return;
329 329
330 prev_state = exception_enter();
331#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP 330#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
332 if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, 331 if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP,
333 SIGTRAP) == NOTIFY_STOP) 332 SIGTRAP) == NOTIFY_STOP)
@@ -338,6 +337,7 @@ dotraplinkage void __kprobes notrace do_int3(struct pt_regs *regs, long error_co
338 if (kprobe_int3_handler(regs)) 337 if (kprobe_int3_handler(regs))
339 return; 338 return;
340#endif 339#endif
340 prev_state = exception_enter();
341 341
342 if (notify_die(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, 342 if (notify_die(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP,
343 SIGTRAP) == NOTIFY_STOP) 343 SIGTRAP) == NOTIFY_STOP)
@@ -415,8 +415,6 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
415 unsigned long dr6; 415 unsigned long dr6;
416 int si_code; 416 int si_code;
417 417
418 prev_state = exception_enter();
419
420 get_debugreg(dr6, 6); 418 get_debugreg(dr6, 6);
421 419
422 /* Filter out all the reserved bits which are preset to 1 */ 420 /* Filter out all the reserved bits which are preset to 1 */
@@ -449,6 +447,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
449 if (kprobe_debug_handler(regs)) 447 if (kprobe_debug_handler(regs))
450 goto exit; 448 goto exit;
451#endif 449#endif
450 prev_state = exception_enter();
452 451
453 if (notify_die(DIE_DEBUG, "debug", regs, (long)&dr6, error_code, 452 if (notify_die(DIE_DEBUG, "debug", regs, (long)&dr6, error_code,
454 SIGTRAP) == NOTIFY_STOP) 453 SIGTRAP) == NOTIFY_STOP)