summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorPrasanna S Panchamukhi <prasanna@in.ibm.com>2005-09-06 15:19:26 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-07 16:57:59 -0700
commitd0aaff9796c3310326d10da44fc0faed352a1d29 (patch)
tree591fd8dedf34464989d23bbb0e66a1ccb2fa18a6 /include/linux
parent505db03639db34ca2c64fe7ee27190d324281f2c (diff)
downloadop-kernel-dev-d0aaff9796c3310326d10da44fc0faed352a1d29.zip
op-kernel-dev-d0aaff9796c3310326d10da44fc0faed352a1d29.tar.gz
[PATCH] Kprobes: prevent possible race conditions generic
There are possible race conditions if probes are placed on routines within the kprobes files and routines used by the kprobes. For example if you put probe on get_kprobe() routines, the system can hang while inserting probes on any routine such as do_fork(). Because while inserting probes on do_fork(), register_kprobes() routine grabs the kprobes spin lock and executes get_kprobe() routine and to handle probe of get_kprobe(), kprobes_handler() gets executed and tries to grab kprobes spin lock, and spins forever. This patch avoids such possible race conditions by preventing probes on routines within the kprobes file and routines used by kprobes. I have modified the patches as per Andi Kleen's suggestion to move kprobes routines and other routines used by kprobes to a seperate section .kprobes.text. Also moved page fault and exception handlers, general protection fault to .kprobes.text section. These patches have been tested on i386, x86_64 and ppc64 architectures, also compiled on ia64 and sparc64 architectures. Signed-off-by: Prasanna S Panchamukhi <prasanna@in.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/kprobes.h3
-rw-r--r--include/linux/linkage.h7
2 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index e050fc2..e30afdc 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -42,6 +42,9 @@
#define KPROBE_REENTER 0x00000004
#define KPROBE_HIT_SSDONE 0x00000008
+/* Attach to insert probes on any functions which should be ignored*/
+#define __kprobes __attribute__((__section__(".kprobes.text")))
+
struct kprobe;
struct pt_regs;
struct kretprobe;
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 338f779..147eb01 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -33,6 +33,13 @@
ALIGN; \
name:
+#define KPROBE_ENTRY(name) \
+ .section .kprobes.text, "ax"; \
+ .globl name; \
+ ALIGN; \
+ name:
+
+
#endif
#define NORET_TYPE /**/
OpenPOWER on IntegriCloud