aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
authorPrasanna S Panchamukhi <prasanna@in.ibm.com>2005-09-06 18:19:26 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-07 19:57:59 -0400
commitd0aaff9796c3310326d10da44fc0faed352a1d29 (patch)
tree591fd8dedf34464989d23bbb0e66a1ccb2fa18a6 /include/asm-generic
parent505db03639db34ca2c64fe7ee27190d324281f2c (diff)
[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/asm-generic')
-rw-r--r--include/asm-generic/sections.h1
-rw-r--r--include/asm-generic/vmlinux.lds.h6
2 files changed, 7 insertions, 0 deletions
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index 450eae22c39a..886dbd116899 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -12,5 +12,6 @@ extern char _sextratext[] __attribute__((weak));
12extern char _eextratext[] __attribute__((weak)); 12extern char _eextratext[] __attribute__((weak));
13extern char _end[]; 13extern char _end[];
14extern char __per_cpu_start[], __per_cpu_end[]; 14extern char __per_cpu_start[], __per_cpu_end[];
15extern char __kprobes_text_start[], __kprobes_text_end[];
15 16
16#endif /* _ASM_GENERIC_SECTIONS_H_ */ 17#endif /* _ASM_GENERIC_SECTIONS_H_ */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 3fa94288aa93..6f857be2b644 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -97,3 +97,9 @@
97 VMLINUX_SYMBOL(__lock_text_start) = .; \ 97 VMLINUX_SYMBOL(__lock_text_start) = .; \
98 *(.spinlock.text) \ 98 *(.spinlock.text) \
99 VMLINUX_SYMBOL(__lock_text_end) = .; 99 VMLINUX_SYMBOL(__lock_text_end) = .;
100
101#define KPROBES_TEXT \
102 ALIGN_FUNCTION(); \
103 VMLINUX_SYMBOL(__kprobes_text_start) = .; \
104 *(.kprobes.text) \
105 VMLINUX_SYMBOL(__kprobes_text_end) = .;