diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2012-09-05 10:31:25 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2012-09-13 22:52:11 -0400 |
commit | c6aaf4d0bb86e2154ea31a33804cec300611255f (patch) | |
tree | 34f973a7ee081daa773b8d4cea9cffaf28bf018a /kernel/kprobes.c | |
parent | 47d5a5f88b9d25d6464c9b60c28f391e84e3ed65 (diff) |
kprobes/x86: Fix to support jprobes on ftrace-based kprobe
Fix kprobes/x86 to support jprobes on ftrace-based kprobes.
Because of -mfentry support of ftrace, ftrace is now put
on the beginning of function where jprobes are put.
Originally ftrace-based kprobes doesn't support jprobe
because it will change regs->ip and ftrace doesn't support
changing IP and ftrace itself doesn't conflict jprobe.
However, ftrace -mfentry support moves mcount call on the
top of functions where jprobes are put. This means that
jprobe always conflicts with ftrace-based kprobe and fails.
This patch allows ftrace-based kprobes to support jprobes
by allowing to modify regs->ip and kprobes breakpoint
handler also allows to skip singlestepping because there
is a ftrace call (not an original instruction).
Link: http://lkml.kernel.org/r/20120905143125.10329.90836.stgit@localhost.localdomain
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/kprobes.c')
-rw-r--r-- | kernel/kprobes.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 35b4315d84f5..098f396aa409 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -1418,9 +1418,6 @@ static __kprobes int check_kprobe_address_safe(struct kprobe *p, | |||
1418 | /* Given address is not on the instruction boundary */ | 1418 | /* Given address is not on the instruction boundary */ |
1419 | if ((unsigned long)p->addr != ftrace_addr) | 1419 | if ((unsigned long)p->addr != ftrace_addr) |
1420 | return -EILSEQ; | 1420 | return -EILSEQ; |
1421 | /* break_handler (jprobe) can not work with ftrace */ | ||
1422 | if (p->break_handler) | ||
1423 | return -EINVAL; | ||
1424 | p->flags |= KPROBE_FLAG_FTRACE; | 1421 | p->flags |= KPROBE_FLAG_FTRACE; |
1425 | #else /* !KPROBES_CAN_USE_FTRACE */ | 1422 | #else /* !KPROBES_CAN_USE_FTRACE */ |
1426 | return -EINVAL; | 1423 | return -EINVAL; |