From 1ae776cedcc21e1717358d602c0ed33d10475858 Mon Sep 17 00:00:00 2001 From: Masami Hiramatsu Date: Tue, 2 Feb 2010 16:49:18 -0500 Subject: [PATCH] --- yaml --- r: 182452 b: refs/heads/master c: 4554dbcb85a4ed2abaa2b6fa15649b796699ec89 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/x86/kernel/kprobes.c | 3 +++ trunk/kernel/kprobes.c | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 4500597957ff..acdbf0d0be22 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2cfa19780d61740f65790c5bae363b759d7c96fa +refs/heads/master: 4554dbcb85a4ed2abaa2b6fa15649b796699ec89 diff --git a/trunk/arch/x86/kernel/kprobes.c b/trunk/arch/x86/kernel/kprobes.c index 9453815138fa..5de9f4a9c3fd 100644 --- a/trunk/arch/x86/kernel/kprobes.c +++ b/trunk/arch/x86/kernel/kprobes.c @@ -337,6 +337,9 @@ static void __kprobes arch_copy_kprobe(struct kprobe *p) int __kprobes arch_prepare_kprobe(struct kprobe *p) { + if (alternatives_text_reserved(p->addr, p->addr)) + return -EINVAL; + if (!can_probe((unsigned long)p->addr)) return -EILSEQ; /* insn: must be on special executable page on x86. */ diff --git a/trunk/kernel/kprobes.c b/trunk/kernel/kprobes.c index 9907a03c29f6..c3340e836c37 100644 --- a/trunk/kernel/kprobes.c +++ b/trunk/kernel/kprobes.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include @@ -703,7 +704,8 @@ int __kprobes register_kprobe(struct kprobe *p) preempt_disable(); if (!kernel_text_address((unsigned long) p->addr) || - in_kprobes_functions((unsigned long) p->addr)) { + in_kprobes_functions((unsigned long) p->addr) || + ftrace_text_reserved(p->addr, p->addr)) { preempt_enable(); return -EINVAL; }