diff options
| -rw-r--r-- | arch/x86/kernel/kprobes.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c index b7c2a85d1926..57916c0d3cf6 100644 --- a/arch/x86/kernel/kprobes.c +++ b/arch/x86/kernel/kprobes.c | |||
| @@ -541,8 +541,23 @@ reenter_kprobe(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb | |||
| 541 | return 1; | 541 | return 1; |
| 542 | } | 542 | } |
| 543 | 543 | ||
| 544 | #ifdef KPROBES_CAN_USE_FTRACE | ||
| 544 | static void __kprobes skip_singlestep(struct kprobe *p, struct pt_regs *regs, | 545 | static void __kprobes skip_singlestep(struct kprobe *p, struct pt_regs *regs, |
| 545 | struct kprobe_ctlblk *kcb); | 546 | struct kprobe_ctlblk *kcb) |
| 547 | { | ||
| 548 | /* | ||
| 549 | * Emulate singlestep (and also recover regs->ip) | ||
| 550 | * as if there is a 5byte nop | ||
| 551 | */ | ||
| 552 | regs->ip = (unsigned long)p->addr + MCOUNT_INSN_SIZE; | ||
| 553 | if (unlikely(p->post_handler)) { | ||
| 554 | kcb->kprobe_status = KPROBE_HIT_SSDONE; | ||
| 555 | p->post_handler(p, regs, 0); | ||
| 556 | } | ||
| 557 | __this_cpu_write(current_kprobe, NULL); | ||
| 558 | } | ||
| 559 | #endif | ||
| 560 | |||
| 546 | /* | 561 | /* |
| 547 | * Interrupts are disabled on entry as trap3 is an interrupt gate and they | 562 | * Interrupts are disabled on entry as trap3 is an interrupt gate and they |
| 548 | * remain disabled throughout this function. | 563 | * remain disabled throughout this function. |
| @@ -1061,21 +1076,6 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) | |||
| 1061 | } | 1076 | } |
| 1062 | 1077 | ||
| 1063 | #ifdef KPROBES_CAN_USE_FTRACE | 1078 | #ifdef KPROBES_CAN_USE_FTRACE |
| 1064 | static void __kprobes skip_singlestep(struct kprobe *p, struct pt_regs *regs, | ||
| 1065 | struct kprobe_ctlblk *kcb) | ||
| 1066 | { | ||
| 1067 | /* | ||
| 1068 | * Emulate singlestep (and also recover regs->ip) | ||
| 1069 | * as if there is a 5byte nop | ||
| 1070 | */ | ||
| 1071 | regs->ip = (unsigned long)p->addr + MCOUNT_INSN_SIZE; | ||
| 1072 | if (unlikely(p->post_handler)) { | ||
| 1073 | kcb->kprobe_status = KPROBE_HIT_SSDONE; | ||
| 1074 | p->post_handler(p, regs, 0); | ||
| 1075 | } | ||
| 1076 | __this_cpu_write(current_kprobe, NULL); | ||
| 1077 | } | ||
| 1078 | |||
| 1079 | /* Ftrace callback handler for kprobes */ | 1079 | /* Ftrace callback handler for kprobes */ |
| 1080 | void __kprobes kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, | 1080 | void __kprobes kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, |
| 1081 | struct ftrace_ops *ops, struct pt_regs *regs) | 1081 | struct ftrace_ops *ops, struct pt_regs *regs) |
