mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
kprobes/x86: Don't call the ->break_handler() in x86 kprobes
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>
This commit is contained in:
parent
059053a275
commit
e704e34cd0
4 changed files with 12 additions and 49 deletions
|
@ -78,7 +78,7 @@ struct arch_specific_insn {
|
||||||
* boostable = true: This instruction has been boosted: we have
|
* boostable = true: This instruction has been boosted: we have
|
||||||
* added a relative jump after the instruction copy in insn,
|
* added a relative jump after the instruction copy in insn,
|
||||||
* so no single-step and fixup are needed (unless there's
|
* so no single-step and fixup are needed (unless there's
|
||||||
* a post_handler or break_handler).
|
* a post_handler).
|
||||||
*/
|
*/
|
||||||
bool boostable;
|
bool boostable;
|
||||||
bool if_modifier;
|
bool if_modifier;
|
||||||
|
|
|
@ -105,14 +105,4 @@ static inline unsigned long __recover_optprobed_insn(kprobe_opcode_t *buf, unsig
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
#endif
|
||||||
|
|
|
@ -709,13 +709,6 @@ int kprobe_int3_handler(struct pt_regs *regs)
|
||||||
regs->ip = (unsigned long)addr;
|
regs->ip = (unsigned long)addr;
|
||||||
preempt_enable_no_resched();
|
preempt_enable_no_resched();
|
||||||
return 1;
|
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 */
|
} /* else: not a kprobe fault; let the kernel handle it */
|
||||||
|
|
||||||
preempt_enable_no_resched();
|
preempt_enable_no_resched();
|
||||||
|
|
|
@ -25,36 +25,6 @@
|
||||||
|
|
||||||
#include "common.h"
|
#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 */
|
/* Ftrace callback handler for kprobes -- called under preepmt disabed */
|
||||||
void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
|
void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
|
||||||
struct ftrace_ops *ops, struct pt_regs *regs)
|
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);
|
__this_cpu_write(current_kprobe, p);
|
||||||
kcb->kprobe_status = KPROBE_HIT_ACTIVE;
|
kcb->kprobe_status = KPROBE_HIT_ACTIVE;
|
||||||
if (!p->pre_handler || !p->pre_handler(p, regs)) {
|
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();
|
preempt_enable_no_resched();
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue