aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>2014-04-17 04:16:51 -0400
committerIngo Molnar <mingo@kernel.org>2014-04-24 04:02:55 -0400
commit6a5022a56ac37da7bffece043331a101ed0040b1 (patch)
treeefe8e5aadff08546e7a2836bf992961601a2d213 /arch
parent4d0fa8a0f01272d4de33704f20303dcecdb55df1 (diff)
kprobes/x86: Allow to handle reentered kprobe on single-stepping
Since the NMI handlers(e.g. perf) can interrupt in the single stepping (or preparing the single stepping, do_debug etc.), we should consider a kprobe is hit in the NMI handler. Even in that case, the kprobe is allowed to be reentered as same as the kprobes hit in kprobe handlers (KPROBE_HIT_ACTIVE or KPROBE_HIT_SSDONE). The real issue will happen when a kprobe hit while another reentered kprobe is processing (KPROBE_REENTER), because we already consumed a saved-area for the previous kprobe. Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Reviewed-by: Steven Rostedt <rostedt@goodmis.org> Cc: Jiri Kosina <jkosina@suse.cz> Cc: Jonathan Lebon <jlebon@redhat.com> Link: http://lkml.kernel.org/r/20140417081651.26341.10593.stgit@ltc230.yrl.intra.hitachi.co.jp Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/kprobes/core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 61b17dc2c277..da7bdaa3ce15 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -531,10 +531,11 @@ reenter_kprobe(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb
531 switch (kcb->kprobe_status) { 531 switch (kcb->kprobe_status) {
532 case KPROBE_HIT_SSDONE: 532 case KPROBE_HIT_SSDONE:
533 case KPROBE_HIT_ACTIVE: 533 case KPROBE_HIT_ACTIVE:
534 case KPROBE_HIT_SS:
534 kprobes_inc_nmissed_count(p); 535 kprobes_inc_nmissed_count(p);
535 setup_singlestep(p, regs, kcb, 1); 536 setup_singlestep(p, regs, kcb, 1);
536 break; 537 break;
537 case KPROBE_HIT_SS: 538 case KPROBE_REENTER:
538 /* A probe has been hit in the codepath leading up to, or just 539 /* A probe has been hit in the codepath leading up to, or just
539 * after, single-stepping of a probed instruction. This entire 540 * after, single-stepping of a probed instruction. This entire
540 * codepath should strictly reside in .kprobes.text section. 541 * codepath should strictly reside in .kprobes.text section.