Skip to content

Commit

Permalink
kprobes: Ensure that jprobe probepoints are at function entry
Browse files Browse the repository at this point in the history
Similar to commit 90ec5e8 ("kretprobes: Ensure probe location is
at function entry"), ensure that the jprobe probepoint is at function
entry.

Signed-off-by: Naveen N. Rao <[email protected]>
Cc: Ananth N Mavinakayanahalli <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Masami Hiramatsu <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Link: http://lkml.kernel.org/r/a4525af6c5a42df385efa31251246cf7cca73598.1499443367.git.naveen.n.rao@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
rnav authored and Ingo Molnar committed Jul 8, 2017
1 parent 0f73ff8 commit dbf5806
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit dbf5806

Please sign in to comment.