diff options
author | Namhyung Kim <namhyung@gmail.com> | 2010-09-15 10:04:27 +0900 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-09-15 10:44:01 +0200 |
commit | 05662bdb64c746079de7ac4dc4fb4caa5e8e119f (patch) | |
tree | 135bb59f626099718f6a325ae1c6a1155015b79e /kernel/kprobes.c | |
parent | edbaadbe42b0b790618ec49d29626223529d8195 (diff) | |
download | linux-05662bdb64c746079de7ac4dc4fb4caa5e8e119f.tar.bz2 |
kprobes: Verify jprobe entry point
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>
Diffstat (limited to 'kernel/kprobes.c')
-rw-r--r-- | kernel/kprobes.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 8f967016cef0..1b0dbe067077 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -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) |