提交 05662bdb 编写于 作者: N Namhyung Kim 提交者: Ingo Molnar

kprobes: Verify jprobe entry point

Verify jprobe's entry point is a function entry point
using kallsyms' offset value.
Signed-off-by: NNamhyung Kim <namhyung@gmail.com>
Acked-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
LKML-Reference: <1284512670-2369-3-git-send-email-namhyung@gmail.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 edbaadbe
...@@ -1339,14 +1339,18 @@ int __kprobes register_jprobes(struct jprobe **jps, int num) ...@@ -1339,14 +1339,18 @@ int __kprobes register_jprobes(struct jprobe **jps, int num)
if (num <= 0) if (num <= 0)
return -EINVAL; return -EINVAL;
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
unsigned long addr; unsigned long addr, offset;
jp = jps[i]; jp = jps[i];
addr = arch_deref_entry_point(jp->entry); addr = arch_deref_entry_point(jp->entry);
/* Todo: Verify probepoint is a function entry point */ /* Verify probepoint is a function entry point */
jp->kp.pre_handler = setjmp_pre_handler; if (kallsyms_lookup_size_offset(addr, NULL, &offset) &&
jp->kp.break_handler = longjmp_break_handler; offset == 0) {
ret = register_kprobe(&jp->kp); 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 (ret < 0) {
if (i > 0) if (i > 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册