kprobes/x86: Don't call the ->break_handler() in x86 kprobes
authorMasami Hiramatsu <mhiramat@kernel.org>
Tue, 19 Jun 2018 16:10:55 +0000 (01:10 +0900)
committerIngo Molnar <mingo@kernel.org>
Thu, 21 Jun 2018 10:33:13 +0000 (12:33 +0200)
Don't call the ->break_handler() and remove break_handler
related code from x86 since that was only used by jprobe
which got removed.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-arch@vger.kernel.org
Link: https://lore.kernel.org/lkml/152942465549.15209.15889693025972771135.stgit@devbox
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/include/asm/kprobes.h
arch/x86/kernel/kprobes/common.h
arch/x86/kernel/kprobes/core.c
arch/x86/kernel/kprobes/ftrace.c

index 06782c2..c8cec1b 100644 (file)
@@ -78,7 +78,7 @@ struct arch_specific_insn {
         * boostable = true: This instruction has been boosted: we have
         * added a relative jump after the instruction copy in insn,
         * so no single-step and fixup are needed (unless there's
-        * a post_handler or break_handler).
+        * a post_handler).
         */
        bool boostable;
        bool if_modifier;
index ae38dcc..2b949f4 100644 (file)
@@ -105,14 +105,4 @@ static inline unsigned long __recover_optprobed_insn(kprobe_opcode_t *buf, unsig
 }
 #endif
 
-#ifdef CONFIG_KPROBES_ON_FTRACE
-extern int skip_singlestep(struct kprobe *p, struct pt_regs *regs,
-                          struct kprobe_ctlblk *kcb);
-#else
-static inline int skip_singlestep(struct kprobe *p, struct pt_regs *regs,
-                                 struct kprobe_ctlblk *kcb)
-{
-       return 0;
-}
-#endif
 #endif
index 1b2d1ac..0ac16a0 100644 (file)
@@ -709,13 +709,6 @@ int kprobe_int3_handler(struct pt_regs *regs)
                regs->ip = (unsigned long)addr;
                preempt_enable_no_resched();
                return 1;
-       } else if (kprobe_running()) {
-               p = __this_cpu_read(current_kprobe);
-               if (p->break_handler && p->break_handler(p, regs)) {
-                       if (!skip_singlestep(p, regs, kcb))
-                               setup_singlestep(p, regs, kcb, 0);
-                       return 1;
-               }
        } /* else: not a kprobe fault; let the kernel handle it */
 
        preempt_enable_no_resched();
index 8dc0161..02a6dd1 100644 (file)
 
 #include "common.h"
 
-static nokprobe_inline
-void __skip_singlestep(struct kprobe *p, struct pt_regs *regs,
-                     struct kprobe_ctlblk *kcb, unsigned long orig_ip)
-{
-       /*
-        * 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);
-       if (orig_ip)
-               regs->ip = orig_ip;
-}
-
-int skip_singlestep(struct kprobe *p, struct pt_regs *regs,
-                   struct kprobe_ctlblk *kcb)
-{
-       if (kprobe_ftrace(p)) {
-               __skip_singlestep(p, regs, kcb, 0);
-               preempt_enable_no_resched();
-               return 1;
-       }
-       return 0;
-}
-NOKPROBE_SYMBOL(skip_singlestep);
-
 /* Ftrace callback handler for kprobes -- called under preepmt disabed */
 void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
                           struct ftrace_ops *ops, struct pt_regs *regs)
@@ -80,7 +50,17 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
                __this_cpu_write(current_kprobe, p);
                kcb->kprobe_status = KPROBE_HIT_ACTIVE;
                if (!p->pre_handler || !p->pre_handler(p, regs)) {
-                       __skip_singlestep(p, regs, kcb, orig_ip);
+                       /*
+                        * 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);
+                       }
+                       regs->ip = orig_ip;
+                       __this_cpu_write(current_kprobe, NULL);
                        preempt_enable_no_resched();
                }
                /*