summaryrefslogtreecommitdiff
path: root/kernel/kprobes.c
diff options
context:
space:
mode:
authorNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>2017-07-07 20:07:26 +0300
committerIngo Molnar <mingo@kernel.org>2017-07-08 12:05:35 +0300
commitdbf580623d5fee785218d1a47a2bcdf36d85c0e9 (patch)
tree9aab0861ecd7bcb74af595243f19b27057866123 /kernel/kprobes.c
parent0f73ff80b751b39ff539a550e65c5bd131ff0316 (diff)
downloadlinux-dbf580623d5fee785218d1a47a2bcdf36d85c0e9.tar.xz
kprobes: Ensure that jprobe probepoints are at function entry
Similar to commit 90ec5e89e393c ("kretprobes: Ensure probe location is at function entry"), ensure that the jprobe probepoint is at function entry. Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/a4525af6c5a42df385efa31251246cf7cca73598.1499443367.git.naveen.n.rao@linux.vnet.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/kprobes.c')
-rw-r--r--kernel/kprobes.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index db3cd3e60bdd..a1606a4224e1 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1795,10 +1795,14 @@ int register_jprobe(struct jprobe *jp)
unsigned long addr, offset;
struct kprobe *kp = &jp->kp;
- /* Verify probepoint is a function entry point */
+ /*
+ * Verify probepoint as well as the jprobe handler are
+ * valid function entry points.
+ */
addr = arch_deref_entry_point(jp->entry);
- if (kallsyms_lookup_size_offset(addr, NULL, &offset) && offset == 0) {
+ if (kallsyms_lookup_size_offset(addr, NULL, &offset) && offset == 0 &&
+ kprobe_on_func_entry(kp->addr, kp->symbol_name, kp->offset)) {
kp->pre_handler = setjmp_pre_handler;
kp->break_handler = longjmp_break_handler;
return register_kprobe(kp);