|
@@ -541,8 +541,23 @@ reenter_kprobe(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
+#ifdef KPROBES_CAN_USE_FTRACE
|
|
|
static void __kprobes skip_singlestep(struct kprobe *p, struct pt_regs *regs,
|
|
|
- struct kprobe_ctlblk *kcb);
|
|
|
+ struct kprobe_ctlblk *kcb)
|
|
|
+{
|
|
|
+ /*
|
|
|
+ * Emulate singlestep (and also recover regs->ip)
|
|
|
+ * as if there is a 5byte nop
|
|
|
+ */
|
|
|
+ regs->ip = (unsigned long)p->addr + MCOUNT_INSN_SIZE;
|
|
|
+ if (unlikely(p->post_handler)) {
|
|
|
+ kcb->kprobe_status = KPROBE_HIT_SSDONE;
|
|
|
+ p->post_handler(p, regs, 0);
|
|
|
+ }
|
|
|
+ __this_cpu_write(current_kprobe, NULL);
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
/*
|
|
|
* Interrupts are disabled on entry as trap3 is an interrupt gate and they
|
|
|
* remain disabled throughout this function.
|
|
@@ -1061,21 +1076,6 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
|
|
|
}
|
|
|
|
|
|
#ifdef KPROBES_CAN_USE_FTRACE
|
|
|
-static void __kprobes skip_singlestep(struct kprobe *p, struct pt_regs *regs,
|
|
|
- struct kprobe_ctlblk *kcb)
|
|
|
-{
|
|
|
- /*
|
|
|
- * Emulate singlestep (and also recover regs->ip)
|
|
|
- * as if there is a 5byte nop
|
|
|
- */
|
|
|
- regs->ip = (unsigned long)p->addr + MCOUNT_INSN_SIZE;
|
|
|
- if (unlikely(p->post_handler)) {
|
|
|
- kcb->kprobe_status = KPROBE_HIT_SSDONE;
|
|
|
- p->post_handler(p, regs, 0);
|
|
|
- }
|
|
|
- __this_cpu_write(current_kprobe, NULL);
|
|
|
-}
|
|
|
-
|
|
|
/* Ftrace callback handler for kprobes */
|
|
|
void __kprobes kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
|
|
|
struct ftrace_ops *ops, struct pt_regs *regs)
|