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

Previous thread: Lnux 2.6.24-rc5 by Linus Torvalds on Monday, December 10, 2007 - 10:40 pm. (2 messages)

Next thread: Reducing the bdi proporion calculation period to speed up disk write by zhejiang on Monday, December 10, 2007 - 11:25 pm. (3 messages)
From: Ananth N Mavinakayanahalli
Date: Monday, December 10, 2007 - 11:22 pm

From: Ananth N Mavinakayanahalli &lt;ananth@in.ibm.com&gt;

This patch adds CONFIG_HAVE_KRETPROBES to the arch/&lt;arch&gt;/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' &quot;Instrumentation menu removal&quot;
patchset (http://marc.info/?l=linux-kernel&amp;m=119496432229633&amp;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 &lt;ananth@in.ibm.com&gt;
---
 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 &quot;N&quot;.
 
+config KRETPROBES
+	def_bool y
+	depends on KPROBES &amp;&amp; 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 HAVE_KPROBES
+	select ...
From: Ananth N Mavinakayanahalli
Date: Monday, December 10, 2007 - 11:24 pm

From: Ananth N Mavinakayanahalli &lt;ananth@in.ibm.com&gt;

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 &lt;ananth@in.ibm.com&gt;
---
 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 &lt;module_name.ko&gt;
 
-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 &quot;Build kretprobes example -- loadable modules only&quot;
+	default m
+	depends on SAMPLE_KPROBES &amp;&amp; KRETPROBES
+
 endif # SAMPLES
 
--

From: Mathieu Desnoyers
Date: Tuesday, December 11, 2007 - 7: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
--

From: Mathieu Desnoyers
Date: Tuesday, December 11, 2007 - 7:39 am

You can add my Acked-by if it helps.

Acked-by: Mathieu Desnoyers &lt;mathieu.desnoyers@polymtl.ca&gt;


-- 
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 Monday, December 10, 2007 - 10:40 pm. (2 messages)

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