Skip to content

Commit dbf5806

Browse files
rnavIngo Molnar
authored andcommitted
kprobes: Ensure that jprobe probepoints are at function entry
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]>
1 parent 0f73ff8 commit dbf5806

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

kernel/kprobes.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,10 +1795,14 @@ int register_jprobe(struct jprobe *jp)
17951795
unsigned long addr, offset;
17961796
struct kprobe *kp = &jp->kp;
17971797

1798-
/* Verify probepoint is a function entry point */
1798+
/*
1799+
* Verify probepoint as well as the jprobe handler are
1800+
* valid function entry points.
1801+
*/
17991802
addr = arch_deref_entry_point(jp->entry);
18001803

1801-
if (kallsyms_lookup_size_offset(addr, NULL, &offset) && offset == 0) {
1804+
if (kallsyms_lookup_size_offset(addr, NULL, &offset) && offset == 0 &&
1805+
kprobe_on_func_entry(kp->addr, kp->symbol_name, kp->offset)) {
18021806
kp->pre_handler = setjmp_pre_handler;
18031807
kp->break_handler = longjmp_break_handler;
18041808
return register_kprobe(kp);

0 commit comments

Comments
 (0)