Commit 00d7c05a authored by Keshavamurthy Anil S's avatar Keshavamurthy Anil S Committed by Linus Torvalds

[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: default avatarAnil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent cda315ab
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/rcupdate.h> #include <linux/rcupdate.h>
#ifdef CONFIG_KPROBES
#include <asm/kprobes.h> #include <asm/kprobes.h>
/* kprobe_status settings */ /* kprobe_status settings */
...@@ -147,7 +148,6 @@ struct kretprobe_instance { ...@@ -147,7 +148,6 @@ struct kretprobe_instance {
struct task_struct *task; struct task_struct *task;
}; };
#ifdef CONFIG_KPROBES
extern spinlock_t kretprobe_lock; extern spinlock_t kretprobe_lock;
extern int arch_prepare_kprobe(struct kprobe *p); extern int arch_prepare_kprobe(struct kprobe *p);
extern void arch_copy_kprobe(struct kprobe *p); extern void arch_copy_kprobe(struct kprobe *p);
...@@ -195,6 +195,11 @@ void add_rp_inst(struct kretprobe_instance *ri); ...@@ -195,6 +195,11 @@ void add_rp_inst(struct kretprobe_instance *ri);
void kprobe_flush_task(struct task_struct *tk); void kprobe_flush_task(struct task_struct *tk);
void recycle_rp_inst(struct kretprobe_instance *ri); void recycle_rp_inst(struct kretprobe_instance *ri);
#else /* CONFIG_KPROBES */ #else /* CONFIG_KPROBES */
#define __kprobes /**/
struct jprobe;
struct kretprobe;
static inline struct kprobe *kprobe_running(void) static inline struct kprobe *kprobe_running(void)
{ {
return NULL; return NULL;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/compat.h> #include <linux/compat.h>
#include <linux/syscalls.h> #include <linux/syscalls.h>
#include <linux/kprobes.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -168,7 +169,7 @@ EXPORT_SYMBOL(notifier_chain_unregister); ...@@ -168,7 +169,7 @@ EXPORT_SYMBOL(notifier_chain_unregister);
* of the last notifier function called. * of the last notifier function called.
*/ */
int notifier_call_chain(struct notifier_block **n, unsigned long val, void *v) int __kprobes notifier_call_chain(struct notifier_block **n, unsigned long val, void *v)
{ {
int ret=NOTIFY_DONE; int ret=NOTIFY_DONE;
struct notifier_block *nb = *n; struct notifier_block *nb = *n;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment