Commit 9edddaa200df18e08fe0cf21036e8ae467b1363c
Committed by
Linus Torvalds
1 parent
8182ec49a7
Exists in
master
and in
4 other branches
Kprobes: indicate kretprobe support in Kconfig
Add CONFIG_HAVE_KRETPROBES to the arch/<arch>/Kconfig file for relevant architectures with kprobes support. This facilitates easy handling of in-kernel modules (like samples/kprobes/kretprobe_example.c) that depend on kretprobes being present in the kernel. Thanks to Sam Ravnborg for helping make the patch more lean. Per Mathieu's suggestion, added CONFIG_KRETPROBES and fixed up dependencies. Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Acked-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Acked-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 15 changed files with 19 additions and 16 deletions Side-by-side Diff
- arch/Kconfig
- arch/arm/Kconfig
- arch/ia64/Kconfig
- arch/powerpc/Kconfig
- arch/s390/Kconfig
- arch/sparc64/Kconfig
- arch/x86/Kconfig
- include/asm-arm/kprobes.h
- include/asm-ia64/kprobes.h
- include/asm-powerpc/kprobes.h
- include/asm-s390/kprobes.h
- include/asm-sparc64/kprobes.h
- include/asm-x86/kprobes.h
- include/linux/kprobes.h
- kernel/kprobes.c
arch/Kconfig
... | ... | @@ -27,6 +27,13 @@ |
27 | 27 | for kernel debugging, non-intrusive instrumentation and testing. |
28 | 28 | If in doubt, say "N". |
29 | 29 | |
30 | +config KRETPROBES | |
31 | + def_bool y | |
32 | + depends on KPROBES && HAVE_KRETPROBES | |
33 | + | |
30 | 34 | config HAVE_KPROBES |
35 | + def_bool n | |
36 | + | |
37 | +config HAVE_KRETPROBES | |
31 | 38 | def_bool n |
arch/arm/Kconfig
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 | select SYS_SUPPORTS_APM_EMULATION |
13 | 13 | select HAVE_OPROFILE |
14 | 14 | select HAVE_KPROBES if (!XIP_KERNEL) |
15 | + select HAVE_KRETPROBES if (HAVE_KPROBES) | |
15 | 16 | help |
16 | 17 | The ARM series is a line of low-power-consumption RISC chip designs |
17 | 18 | licensed by ARM Ltd and targeted at embedded applications and |
arch/ia64/Kconfig
arch/powerpc/Kconfig
arch/s390/Kconfig
arch/sparc64/Kconfig
arch/x86/Kconfig
include/asm-arm/kprobes.h
include/asm-ia64/kprobes.h
include/asm-powerpc/kprobes.h
include/asm-s390/kprobes.h
include/asm-sparc64/kprobes.h
include/asm-x86/kprobes.h
include/linux/kprobes.h
... | ... | @@ -125,11 +125,11 @@ |
125 | 125 | DECLARE_PER_CPU(struct kprobe *, current_kprobe); |
126 | 126 | DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); |
127 | 127 | |
128 | -#ifdef ARCH_SUPPORTS_KRETPROBES | |
128 | +#ifdef CONFIG_KRETPROBES | |
129 | 129 | extern void arch_prepare_kretprobe(struct kretprobe_instance *ri, |
130 | 130 | struct pt_regs *regs); |
131 | 131 | extern int arch_trampoline_kprobe(struct kprobe *p); |
132 | -#else /* ARCH_SUPPORTS_KRETPROBES */ | |
132 | +#else /* CONFIG_KRETPROBES */ | |
133 | 133 | static inline void arch_prepare_kretprobe(struct kretprobe *rp, |
134 | 134 | struct pt_regs *regs) |
135 | 135 | { |
... | ... | @@ -138,7 +138,7 @@ |
138 | 138 | { |
139 | 139 | return 0; |
140 | 140 | } |
141 | -#endif /* ARCH_SUPPORTS_KRETPROBES */ | |
141 | +#endif /* CONFIG_KRETPROBES */ | |
142 | 142 | /* |
143 | 143 | * Function-return probe - |
144 | 144 | * Note: |
kernel/kprobes.c
... | ... | @@ -678,8 +678,7 @@ |
678 | 678 | unregister_kprobe(&jp->kp); |
679 | 679 | } |
680 | 680 | |
681 | -#ifdef ARCH_SUPPORTS_KRETPROBES | |
682 | - | |
681 | +#ifdef CONFIG_KRETPROBES | |
683 | 682 | /* |
684 | 683 | * This kprobe pre_handler is registered with every kretprobe. When probe |
685 | 684 | * hits it will set up the return probe. |
... | ... | @@ -769,8 +768,7 @@ |
769 | 768 | return ret; |
770 | 769 | } |
771 | 770 | |
772 | -#else /* ARCH_SUPPORTS_KRETPROBES */ | |
773 | - | |
771 | +#else /* CONFIG_KRETPROBES */ | |
774 | 772 | int __kprobes register_kretprobe(struct kretprobe *rp) |
775 | 773 | { |
776 | 774 | return -ENOSYS; |
... | ... | @@ -781,8 +779,7 @@ |
781 | 779 | { |
782 | 780 | return 0; |
783 | 781 | } |
784 | - | |
785 | -#endif /* ARCH_SUPPORTS_KRETPROBES */ | |
782 | +#endif /* CONFIG_KRETPROBES */ | |
786 | 783 | |
787 | 784 | void __kprobes unregister_kretprobe(struct kretprobe *rp) |
788 | 785 | { |