diff options
author | Keshavamurthy Anil S <anil.s.keshavamurthy@intel.com> | 2005-12-12 03:37:33 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-12-12 11:57:45 -0500 |
commit | 00d7c05ab168c10f9b520e07400923267bc04419 (patch) | |
tree | 5899743965a801e34e7dc6bfe59dba20ba023540 | |
parent | cda315aba34ff4fb66bbb2945b723688f3414a75 (diff) |
[PATCH] kprobes: no probes on critical path
For Kprobes critical path is the path from debug break exception handler
till the control reaches kprobes exception code. No probes can be
supported in this path as we will end up in recursion.
This patch prevents this by moving the below function to safe __kprobes
section onto which no probes can be inserted.
Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | include/linux/kprobes.h | 7 | ||||
-rw-r--r-- | kernel/sys.c | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index e373c4a9de53..434ecfd7cf48 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
38 | #include <linux/rcupdate.h> | 38 | #include <linux/rcupdate.h> |
39 | 39 | ||
40 | #ifdef CONFIG_KPROBES | ||
40 | #include <asm/kprobes.h> | 41 | #include <asm/kprobes.h> |
41 | 42 | ||
42 | /* kprobe_status settings */ | 43 | /* kprobe_status settings */ |
@@ -147,7 +148,6 @@ struct kretprobe_instance { | |||
147 | struct task_struct *task; | 148 | struct task_struct *task; |
148 | }; | 149 | }; |
149 | 150 | ||
150 | #ifdef CONFIG_KPROBES | ||
151 | extern spinlock_t kretprobe_lock; | 151 | extern spinlock_t kretprobe_lock; |
152 | extern int arch_prepare_kprobe(struct kprobe *p); | 152 | extern int arch_prepare_kprobe(struct kprobe *p); |
153 | extern void arch_copy_kprobe(struct kprobe *p); | 153 | extern void arch_copy_kprobe(struct kprobe *p); |
@@ -195,6 +195,11 @@ void add_rp_inst(struct kretprobe_instance *ri); | |||
195 | void kprobe_flush_task(struct task_struct *tk); | 195 | void kprobe_flush_task(struct task_struct *tk); |
196 | void recycle_rp_inst(struct kretprobe_instance *ri); | 196 | void recycle_rp_inst(struct kretprobe_instance *ri); |
197 | #else /* CONFIG_KPROBES */ | 197 | #else /* CONFIG_KPROBES */ |
198 | |||
199 | #define __kprobes /**/ | ||
200 | struct jprobe; | ||
201 | struct kretprobe; | ||
202 | |||
198 | static inline struct kprobe *kprobe_running(void) | 203 | static inline struct kprobe *kprobe_running(void) |
199 | { | 204 | { |
200 | return NULL; | 205 | return NULL; |
diff --git a/kernel/sys.c b/kernel/sys.c index bce933ebb29f..eecf84526afe 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
33 | #include <linux/compat.h> | 33 | #include <linux/compat.h> |
34 | #include <linux/syscalls.h> | 34 | #include <linux/syscalls.h> |
35 | #include <linux/kprobes.h> | ||
35 | 36 | ||
36 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
37 | #include <asm/io.h> | 38 | #include <asm/io.h> |
@@ -168,7 +169,7 @@ EXPORT_SYMBOL(notifier_chain_unregister); | |||
168 | * of the last notifier function called. | 169 | * of the last notifier function called. |
169 | */ | 170 | */ |
170 | 171 | ||
171 | int notifier_call_chain(struct notifier_block **n, unsigned long val, void *v) | 172 | int __kprobes notifier_call_chain(struct notifier_block **n, unsigned long val, void *v) |
172 | { | 173 | { |
173 | int ret=NOTIFY_DONE; | 174 | int ret=NOTIFY_DONE; |
174 | struct notifier_block *nb = *n; | 175 | struct notifier_block *nb = *n; |