aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2010-09-14 21:04:27 -0400
committerIngo Molnar <mingo@elte.hu>2010-09-15 04:44:01 -0400
commit05662bdb64c746079de7ac4dc4fb4caa5e8e119f (patch)
tree135bb59f626099718f6a325ae1c6a1155015b79e /kernel
parentedbaadbe42b0b790618ec49d29626223529d8195 (diff)
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')
-rw-r--r--kernel/kprobes.c14
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)
1339 if (num <= 0) 1339 if (num <= 0)
1340 return -EINVAL; 1340 return -EINVAL;
1341 for (i = 0; i < num; i++) { 1341 for (i = 0; i < num; i++) {
1342 unsigned long addr; 1342 unsigned long addr, offset;
1343 jp = jps[i]; 1343 jp = jps[i];
1344 addr = arch_deref_entry_point(jp->entry); 1344 addr = arch_deref_entry_point(jp->entry);
1345 1345
1346 /* Todo: Verify probepoint is a function entry point */ 1346 /* Verify probepoint is a function entry point */
1347 jp->kp.pre_handler = setjmp_pre_handler; 1347 if (kallsyms_lookup_size_offset(addr, NULL, &offset) &&
1348 jp->kp.break_handler = longjmp_break_handler; 1348 offset == 0) {
1349 ret = register_kprobe(&jp->kp); 1349 jp->kp.pre_handler = setjmp_pre_handler;
1350 jp->kp.break_handler = longjmp_break_handler;
1351 ret = register_kprobe(&jp->kp);
1352 } else
1353 ret = -EINVAL;
1350 1354
1351 if (ret < 0) { 1355 if (ret < 0) {
1352 if (i > 0) 1356 if (i > 0)