Skip to content

Commit

Permalink
kprobes: Verify jprobe entry point
Browse files Browse the repository at this point in the history
Verify jprobe's entry point is a function entry point
using kallsyms' offset value.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
LKML-Reference: <1284512670-2369-3-git-send-email-namhyung@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
namhyung authored and Ingo Molnar committed Sep 15, 2010
1 parent edbaadb commit 05662bd
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1339,14 +1339,18 @@ int __kprobes register_jprobes(struct jprobe **jps, int num)
if (num <= 0)
return -EINVAL;
for (i = 0; i < num; i++) {
unsigned long addr;
unsigned long addr, offset;
jp = jps[i];
addr = arch_deref_entry_point(jp->entry);

/* Todo: Verify probepoint is a function entry point */
jp->kp.pre_handler = setjmp_pre_handler;
jp->kp.break_handler = longjmp_break_handler;
ret = register_kprobe(&jp->kp);
/* Verify probepoint is a function entry point */
if (kallsyms_lookup_size_offset(addr, NULL, &offset) &&
offset == 0) {
jp->kp.pre_handler = setjmp_pre_handler;
jp->kp.break_handler = longjmp_break_handler;
ret = register_kprobe(&jp->kp);
} else
ret = -EINVAL;

if (ret < 0) {
if (i > 0)
Expand Down

0 comments on commit 05662bd

Please sign in to comment.