[PATCH 1/2 V2] Kprobes: Indicate kretprobe support in arch/<arch>/Kconfig

Previous thread: Lnux 2.6.24-rc5 by Linus Torvalds on Tuesday, December 11, 2007 - 1:40 am. (3 messages)

Next thread: Reducing the bdi proporion calculation period to speed up disk write by zhejiang on Tuesday, December 11, 2007 - 2:25 am. (3 messages)
To: <akpm@...>
Cc: lkml <linux-kernel@...>, Anil S Keshavamurthy <anil.s.keshavamurthy@...>, <davem@...>, <mathieu.desnoyers@...>, <hskinnemoen@...>, <sam@...>
Date: Tuesday, December 11, 2007 - 2:22 am

From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>

This patch adds 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.

This patch depends on Mathieu Desnoyers' "Instrumentation menu removal"
patchset (http://marc.info/?l=linux-kernel&m=119496432229633&w=2)

Updated to apply on 2.6.24-rc4-mm1. Thanks to Sam Ravnborg for helping
make the patch more lean.

V2: Per Mathieu's suggestion, added CONFIG_KRETPROBES and fixed up
dependencies.

Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
---
arch/Kconfig | 7 +++++++
arch/ia64/Kconfig | 1 +
arch/powerpc/Kconfig | 1 +
arch/s390/Kconfig | 1 +
arch/x86/Kconfig | 1 +
include/asm-ia64/kprobes.h | 1 -
include/asm-powerpc/kprobes.h | 1 -
include/asm-x86/kprobes_32.h | 1 -
include/asm-x86/kprobes_64.h | 1 -
include/linux/kprobes.h | 6 +++---
kernel/kprobes.c | 8 +++-----
11 files changed, 17 insertions(+), 12 deletions(-)

Index: linux-2.6.24-rc4/arch/Kconfig
===================================================================
--- linux-2.6.24-rc4.orig/arch/Kconfig
+++ linux-2.6.24-rc4/arch/Kconfig
@@ -27,5 +27,12 @@ config KPROBES
for kernel debugging, non-intrusive instrumentation and testing.
If in doubt, say "N".

+config KRETPROBES
+ def_bool y
+ depends on KPROBES && HAVE_KRETPROBES
+
config HAVE_KPROBES
def_bool n
+
+config HAVE_KRETPROBES
+ def_bool n
Index: linux-2.6.24-rc4/arch/ia64/Kconfig
===================================================================
--- linux-2.6.24-rc4.orig/arch/ia64/Kconfig
+++ linux-2.6.24-rc4/arch/ia64/Kconfig
@@ -17,6 +17,7 @@ config IA64
select ARCH_SUPPORTS_MSI
select HAVE_OPROFILE
select...

To: Ananth N Mavinakayanahalli <ananth@...>
Cc: <akpm@...>, lkml <linux-kernel@...>, Anil S Keshavamurthy <anil.s.keshavamurthy@...>, <davem@...>, <hskinnemoen@...>, <sam@...>
Date: Tuesday, December 11, 2007 - 10:39 am

You can add my Acked-by if it helps.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>

--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
--

To: <akpm@...>
Cc: lkml <linux-kernel@...>, Anil S Keshavamurthy <anil.s.keshavamurthy@...>, <davem@...>, <mathieu.desnoyers@...>, <hskinnemoen@...>, <sam@...>
Date: Tuesday, December 11, 2007 - 2:24 am

From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>

This patch builds samples/kprobes/kretprobe_example.c only on archs that
support kretprobes. Thanks to Sam Ravnborg for Kconfig suggestions.

V2: Updated dependency on CONFIG_KRETPROBES

Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
---
samples/Kconfig | 5 +++++
samples/kprobes/Makefile | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)

Index: linux-2.6.24-rc4/samples/kprobes/Makefile
===================================================================
--- linux-2.6.24-rc4.orig/samples/kprobes/Makefile
+++ linux-2.6.24-rc4/samples/kprobes/Makefile
@@ -1,5 +1,5 @@
# builds the kprobes example kernel modules;
# then to use one (as root): insmod <module_name.ko>

-obj-$(CONFIG_SAMPLE_KPROBES) += kprobe_example.o jprobe_example.o \
- kretprobe_example.o
+obj-$(CONFIG_SAMPLE_KPROBES) += kprobe_example.o jprobe_example.o
+obj-$(CONFIG_SAMPLE_KRETPROBES) += kretprobe_example.o
Index: linux-2.6.24-rc4/samples/Kconfig
===================================================================
--- linux-2.6.24-rc4.orig/samples/Kconfig
+++ linux-2.6.24-rc4/samples/Kconfig
@@ -28,5 +28,10 @@ config SAMPLE_KPROBES
help
This build several kprobes example modules.

+config SAMPLE_KRETPROBES
+ tristate "Build kretprobes example -- loadable modules only"
+ default m
+ depends on SAMPLE_KPROBES && KRETPROBES
+
endif # SAMPLES

--

To: Ananth N Mavinakayanahalli <ananth@...>
Cc: <akpm@...>, lkml <linux-kernel@...>, Anil S Keshavamurthy <anil.s.keshavamurthy@...>, <davem@...>, <hskinnemoen@...>, <sam@...>
Date: Tuesday, December 11, 2007 - 10:39 am

--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
--

Previous thread: Lnux 2.6.24-rc5 by Linus Torvalds on Tuesday, December 11, 2007 - 1:40 am. (3 messages)

Next thread: Reducing the bdi proporion calculation period to speed up disk write by zhejiang on Tuesday, December 11, 2007 - 2:25 am. (3 messages)