diff options
-rw-r--r-- | arch/Kconfig | 7 | ||||
-rw-r--r-- | arch/arm/Kconfig | 1 | ||||
-rw-r--r-- | arch/ia64/Kconfig | 1 | ||||
-rw-r--r-- | arch/powerpc/Kconfig | 1 | ||||
-rw-r--r-- | arch/s390/Kconfig | 1 | ||||
-rw-r--r-- | arch/sparc64/Kconfig | 1 | ||||
-rw-r--r-- | arch/x86/Kconfig | 1 | ||||
-rw-r--r-- | include/asm-arm/kprobes.h | 1 | ||||
-rw-r--r-- | include/asm-ia64/kprobes.h | 1 | ||||
-rw-r--r-- | include/asm-powerpc/kprobes.h | 1 | ||||
-rw-r--r-- | include/asm-s390/kprobes.h | 1 | ||||
-rw-r--r-- | include/asm-sparc64/kprobes.h | 2 | ||||
-rw-r--r-- | include/asm-x86/kprobes.h | 1 | ||||
-rw-r--r-- | include/linux/kprobes.h | 6 | ||||
-rw-r--r-- | kernel/kprobes.c | 9 |
15 files changed, 19 insertions, 16 deletions
diff --git a/arch/Kconfig b/arch/Kconfig index 3d72dc3fc8f5..694c9af520bb 100644 --- a/arch/Kconfig +++ b/arch/Kconfig | |||
@@ -27,5 +27,12 @@ config KPROBES | |||
27 | for kernel debugging, non-intrusive instrumentation and testing. | 27 | for kernel debugging, non-intrusive instrumentation and testing. |
28 | If in doubt, say "N". | 28 | If in doubt, say "N". |
29 | 29 | ||
30 | config KRETPROBES | ||
31 | def_bool y | ||
32 | depends on KPROBES && HAVE_KRETPROBES | ||
33 | |||
30 | config HAVE_KPROBES | 34 | config HAVE_KPROBES |
31 | def_bool n | 35 | def_bool n |
36 | |||
37 | config HAVE_KRETPROBES | ||
38 | def_bool n | ||
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 16b82e1272b0..955fc53c1c01 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -12,6 +12,7 @@ config ARM | |||
12 | select SYS_SUPPORTS_APM_EMULATION | 12 | select SYS_SUPPORTS_APM_EMULATION |
13 | select HAVE_OPROFILE | 13 | select HAVE_OPROFILE |
14 | select HAVE_KPROBES if (!XIP_KERNEL) | 14 | select HAVE_KPROBES if (!XIP_KERNEL) |
15 | select HAVE_KRETPROBES if (HAVE_KPROBES) | ||
15 | help | 16 | help |
16 | The ARM series is a line of low-power-consumption RISC chip designs | 17 | The ARM series is a line of low-power-consumption RISC chip designs |
17 | licensed by ARM Ltd and targeted at embedded applications and | 18 | licensed by ARM Ltd and targeted at embedded applications and |
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index dff9edfc7465..56762d3c2a6a 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -18,6 +18,7 @@ config IA64 | |||
18 | select HAVE_IDE | 18 | select HAVE_IDE |
19 | select HAVE_OPROFILE | 19 | select HAVE_OPROFILE |
20 | select HAVE_KPROBES | 20 | select HAVE_KPROBES |
21 | select HAVE_KRETPROBES | ||
21 | default y | 22 | default y |
22 | help | 23 | help |
23 | The Itanium Processor Family is Intel's 64-bit successor to | 24 | The Itanium Processor Family is Intel's 64-bit successor to |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 5b8d8382b762..1189d8d6170d 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -90,6 +90,7 @@ config PPC | |||
90 | select HAVE_IDE | 90 | select HAVE_IDE |
91 | select HAVE_OPROFILE | 91 | select HAVE_OPROFILE |
92 | select HAVE_KPROBES | 92 | select HAVE_KPROBES |
93 | select HAVE_KRETPROBES | ||
93 | 94 | ||
94 | config EARLY_PRINTK | 95 | config EARLY_PRINTK |
95 | bool | 96 | bool |
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index b21444b681b6..9892827b6176 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -61,6 +61,7 @@ config S390 | |||
61 | def_bool y | 61 | def_bool y |
62 | select HAVE_OPROFILE | 62 | select HAVE_OPROFILE |
63 | select HAVE_KPROBES | 63 | select HAVE_KPROBES |
64 | select HAVE_KRETPROBES | ||
64 | 65 | ||
65 | source "init/Kconfig" | 66 | source "init/Kconfig" |
66 | 67 | ||
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index 3af378ddb6ae..463d1be32c98 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig | |||
@@ -10,6 +10,7 @@ config SPARC | |||
10 | default y | 10 | default y |
11 | select HAVE_OPROFILE | 11 | select HAVE_OPROFILE |
12 | select HAVE_KPROBES | 12 | select HAVE_KPROBES |
13 | select HAVE_KRETPROBES | ||
13 | 14 | ||
14 | config SPARC64 | 15 | config SPARC64 |
15 | bool | 16 | bool |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 53800b80a204..f41c9538ca30 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -21,6 +21,7 @@ config X86 | |||
21 | select HAVE_IDE | 21 | select HAVE_IDE |
22 | select HAVE_OPROFILE | 22 | select HAVE_OPROFILE |
23 | select HAVE_KPROBES | 23 | select HAVE_KPROBES |
24 | select HAVE_KRETPROBES | ||
24 | select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) | 25 | select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) |
25 | 26 | ||
26 | 27 | ||
diff --git a/include/asm-arm/kprobes.h b/include/asm-arm/kprobes.h index 4e7bd32288ae..c042194d3ab5 100644 --- a/include/asm-arm/kprobes.h +++ b/include/asm-arm/kprobes.h | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/ptrace.h> | 20 | #include <linux/ptrace.h> |
21 | #include <linux/percpu.h> | 21 | #include <linux/percpu.h> |
22 | 22 | ||
23 | #define ARCH_SUPPORTS_KRETPROBES | ||
24 | #define __ARCH_WANT_KPROBES_INSN_SLOT | 23 | #define __ARCH_WANT_KPROBES_INSN_SLOT |
25 | #define MAX_INSN_SIZE 2 | 24 | #define MAX_INSN_SIZE 2 |
26 | #define MAX_STACK_SIZE 64 /* 32 would probably be OK */ | 25 | #define MAX_STACK_SIZE 64 /* 32 would probably be OK */ |
diff --git a/include/asm-ia64/kprobes.h b/include/asm-ia64/kprobes.h index a93ce9ef07ff..adbaba14eb0a 100644 --- a/include/asm-ia64/kprobes.h +++ b/include/asm-ia64/kprobes.h | |||
@@ -82,7 +82,6 @@ struct kprobe_ctlblk { | |||
82 | struct prev_kprobe prev_kprobe[ARCH_PREV_KPROBE_SZ]; | 82 | struct prev_kprobe prev_kprobe[ARCH_PREV_KPROBE_SZ]; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | #define ARCH_SUPPORTS_KRETPROBES | ||
86 | #define kretprobe_blacklist_size 0 | 85 | #define kretprobe_blacklist_size 0 |
87 | 86 | ||
88 | #define SLOT0_OPCODE_SHIFT (37) | 87 | #define SLOT0_OPCODE_SHIFT (37) |
diff --git a/include/asm-powerpc/kprobes.h b/include/asm-powerpc/kprobes.h index afabad230dbb..d0e7701fa1f6 100644 --- a/include/asm-powerpc/kprobes.h +++ b/include/asm-powerpc/kprobes.h | |||
@@ -80,7 +80,6 @@ typedef unsigned int kprobe_opcode_t; | |||
80 | #define is_trap(instr) (IS_TW(instr) || IS_TWI(instr)) | 80 | #define is_trap(instr) (IS_TW(instr) || IS_TWI(instr)) |
81 | #endif | 81 | #endif |
82 | 82 | ||
83 | #define ARCH_SUPPORTS_KRETPROBES | ||
84 | #define flush_insn_slot(p) do { } while (0) | 83 | #define flush_insn_slot(p) do { } while (0) |
85 | #define kretprobe_blacklist_size 0 | 84 | #define kretprobe_blacklist_size 0 |
86 | 85 | ||
diff --git a/include/asm-s390/kprobes.h b/include/asm-s390/kprobes.h index 948db3d0d05c..330f68caffe4 100644 --- a/include/asm-s390/kprobes.h +++ b/include/asm-s390/kprobes.h | |||
@@ -46,7 +46,6 @@ typedef u16 kprobe_opcode_t; | |||
46 | ? (MAX_STACK_SIZE) \ | 46 | ? (MAX_STACK_SIZE) \ |
47 | : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) | 47 | : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) |
48 | 48 | ||
49 | #define ARCH_SUPPORTS_KRETPROBES | ||
50 | #define kretprobe_blacklist_size 0 | 49 | #define kretprobe_blacklist_size 0 |
51 | 50 | ||
52 | #define KPROBE_SWAP_INST 0x10 | 51 | #define KPROBE_SWAP_INST 0x10 |
diff --git a/include/asm-sparc64/kprobes.h b/include/asm-sparc64/kprobes.h index 7237dd87663e..5879d71afdaa 100644 --- a/include/asm-sparc64/kprobes.h +++ b/include/asm-sparc64/kprobes.h | |||
@@ -14,8 +14,6 @@ typedef u32 kprobe_opcode_t; | |||
14 | 14 | ||
15 | #define arch_remove_kprobe(p) do {} while (0) | 15 | #define arch_remove_kprobe(p) do {} while (0) |
16 | 16 | ||
17 | #define ARCH_SUPPORTS_KRETPROBES | ||
18 | |||
19 | #define flush_insn_slot(p) \ | 17 | #define flush_insn_slot(p) \ |
20 | do { flushi(&(p)->ainsn.insn[0]); \ | 18 | do { flushi(&(p)->ainsn.insn[0]); \ |
21 | flushi(&(p)->ainsn.insn[1]); \ | 19 | flushi(&(p)->ainsn.insn[1]); \ |
diff --git a/include/asm-x86/kprobes.h b/include/asm-x86/kprobes.h index 143476a3cb52..61ad7b5d142e 100644 --- a/include/asm-x86/kprobes.h +++ b/include/asm-x86/kprobes.h | |||
@@ -42,7 +42,6 @@ typedef u8 kprobe_opcode_t; | |||
42 | : (((unsigned long)current_thread_info()) + THREAD_SIZE \ | 42 | : (((unsigned long)current_thread_info()) + THREAD_SIZE \ |
43 | - (unsigned long)(ADDR))) | 43 | - (unsigned long)(ADDR))) |
44 | 44 | ||
45 | #define ARCH_SUPPORTS_KRETPROBES | ||
46 | #define flush_insn_slot(p) do { } while (0) | 45 | #define flush_insn_slot(p) do { } while (0) |
47 | 46 | ||
48 | extern const int kretprobe_blacklist_size; | 47 | extern const int kretprobe_blacklist_size; |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 4a6ce82ba039..0f28486f6360 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -125,11 +125,11 @@ struct jprobe { | |||
125 | DECLARE_PER_CPU(struct kprobe *, current_kprobe); | 125 | DECLARE_PER_CPU(struct kprobe *, current_kprobe); |
126 | DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); | 126 | DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); |
127 | 127 | ||
128 | #ifdef ARCH_SUPPORTS_KRETPROBES | 128 | #ifdef CONFIG_KRETPROBES |
129 | extern void arch_prepare_kretprobe(struct kretprobe_instance *ri, | 129 | extern void arch_prepare_kretprobe(struct kretprobe_instance *ri, |
130 | struct pt_regs *regs); | 130 | struct pt_regs *regs); |
131 | extern int arch_trampoline_kprobe(struct kprobe *p); | 131 | extern int arch_trampoline_kprobe(struct kprobe *p); |
132 | #else /* ARCH_SUPPORTS_KRETPROBES */ | 132 | #else /* CONFIG_KRETPROBES */ |
133 | static inline void arch_prepare_kretprobe(struct kretprobe *rp, | 133 | static inline void arch_prepare_kretprobe(struct kretprobe *rp, |
134 | struct pt_regs *regs) | 134 | struct pt_regs *regs) |
135 | { | 135 | { |
@@ -138,7 +138,7 @@ static inline int arch_trampoline_kprobe(struct kprobe *p) | |||
138 | { | 138 | { |
139 | return 0; | 139 | return 0; |
140 | } | 140 | } |
141 | #endif /* ARCH_SUPPORTS_KRETPROBES */ | 141 | #endif /* CONFIG_KRETPROBES */ |
142 | /* | 142 | /* |
143 | * Function-return probe - | 143 | * Function-return probe - |
144 | * Note: | 144 | * Note: |
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 7a86e6432338..e6a61dcbc578 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -678,8 +678,7 @@ void __kprobes unregister_jprobe(struct jprobe *jp) | |||
678 | unregister_kprobe(&jp->kp); | 678 | unregister_kprobe(&jp->kp); |
679 | } | 679 | } |
680 | 680 | ||
681 | #ifdef ARCH_SUPPORTS_KRETPROBES | 681 | #ifdef CONFIG_KRETPROBES |
682 | |||
683 | /* | 682 | /* |
684 | * This kprobe pre_handler is registered with every kretprobe. When probe | 683 | * This kprobe pre_handler is registered with every kretprobe. When probe |
685 | * hits it will set up the return probe. | 684 | * hits it will set up the return probe. |
@@ -769,8 +768,7 @@ int __kprobes register_kretprobe(struct kretprobe *rp) | |||
769 | return ret; | 768 | return ret; |
770 | } | 769 | } |
771 | 770 | ||
772 | #else /* ARCH_SUPPORTS_KRETPROBES */ | 771 | #else /* CONFIG_KRETPROBES */ |
773 | |||
774 | int __kprobes register_kretprobe(struct kretprobe *rp) | 772 | int __kprobes register_kretprobe(struct kretprobe *rp) |
775 | { | 773 | { |
776 | return -ENOSYS; | 774 | return -ENOSYS; |
@@ -781,8 +779,7 @@ static int __kprobes pre_handler_kretprobe(struct kprobe *p, | |||
781 | { | 779 | { |
782 | return 0; | 780 | return 0; |
783 | } | 781 | } |
784 | 782 | #endif /* CONFIG_KRETPROBES */ | |
785 | #endif /* ARCH_SUPPORTS_KRETPROBES */ | ||
786 | 783 | ||
787 | void __kprobes unregister_kretprobe(struct kretprobe *rp) | 784 | void __kprobes unregister_kretprobe(struct kretprobe *rp) |
788 | { | 785 | { |