lkml.org 
[lkml]   [2007]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 1/2] Kprobes: Indicate kretprobe support in arch/<arch>/Kconfig
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>

This patch adds CONFIG_ARCH_SUPPORTS_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)


Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
---
arch/avr32/Kconfig | 5 +++++
arch/ia64/Kconfig | 5 +++++
arch/powerpc/Kconfig | 5 +++++
arch/s390/Kconfig | 5 +++++
arch/sparc64/Kconfig | 5 +++++
arch/x86/Kconfig.i386 | 5 +++++
arch/x86/Kconfig.x86_64 | 5 +++++
include/asm-ia64/kprobes.h | 1 -
include/asm-powerpc/kprobes.h | 1 -
include/asm-s390/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 | 6 +++---
14 files changed, 41 insertions(+), 11 deletions(-)
Index: kernel-13nov/arch/avr32/Kconfig
===================================================================
--- kernel-13nov.orig/arch/avr32/Kconfig
+++ kernel-13nov/arch/avr32/Kconfig
@@ -73,6 +73,11 @@ config GENERIC_BUG
config ARCH_SUPPORTS_KPROBES
def_bool y

+config ARCH_SUPPORTS_KRETPROBES
+ bool
+ depends on ARCH_SUPPORTS_KPROBES
+ default n
+
source "init/Kconfig"

menu "System Type and features"
Index: kernel-13nov/arch/ia64/Kconfig
===================================================================
--- kernel-13nov.orig/arch/ia64/Kconfig
+++ kernel-13nov/arch/ia64/Kconfig
@@ -105,6 +105,11 @@ config ARCH_SUPPORTS_OPROFILE
config ARCH_SUPPORTS_KPROBES
def_bool y

+config ARCH_SUPPORTS_KRETPROBES
+ bool
+ depends on ARCH_SUPPORTS_KPROBES
+ default y
+
choice
prompt "System type"
default IA64_GENERIC
Index: kernel-13nov/arch/powerpc/Kconfig
===================================================================
--- kernel-13nov.orig/arch/powerpc/Kconfig
+++ kernel-13nov/arch/powerpc/Kconfig
@@ -169,6 +169,11 @@ config ARCH_SUPPORTS_OPROFILE
config ARCH_SUPPORTS_KPROBES
def_bool y

+config ARCH_SUPPORTS_KRETPROBES
+ bool
+ depends on ARCH_SUPPORTS_KPROBES
+ default y
+
source "init/Kconfig"

source "arch/powerpc/platforms/Kconfig"
Index: kernel-13nov/arch/s390/Kconfig
===================================================================
--- kernel-13nov.orig/arch/s390/Kconfig
+++ kernel-13nov/arch/s390/Kconfig
@@ -58,6 +58,11 @@ config ARCH_SUPPORTS_OPROFILE
config ARCH_SUPPORTS_KPROBES
def_bool y

+config ARCH_SUPPORTS_KRETPROBES
+ bool
+ depends on ARCH_SUPPORTS_KPROBES
+ default y
+
source "init/Kconfig"

menu "Base setup"
Index: kernel-13nov/arch/sparc64/Kconfig
===================================================================
--- kernel-13nov.orig/arch/sparc64/Kconfig
+++ kernel-13nov/arch/sparc64/Kconfig
@@ -82,6 +82,11 @@ config ARCH_SUPPORTS_OPROFILE
config ARCH_SUPPORTS_KPROBES
def_bool y

+config ARCH_SUPPORTS_KRETPROBES
+ bool
+ depends on ARCH_SUPPORTS_KPROBES
+ default n
+
choice
prompt "Kernel page size"
default SPARC64_PAGE_SIZE_8KB
Index: kernel-13nov/arch/x86/Kconfig.i386
===================================================================
--- kernel-13nov.orig/arch/x86/Kconfig.i386
+++ kernel-13nov/arch/x86/Kconfig.i386
@@ -97,6 +97,11 @@ config ARCH_SUPPORTS_OPROFILE
config ARCH_SUPPORTS_KPROBES
def_bool y

+config ARCH_SUPPORTS_KRETPROBES
+ bool
+ depends on ARCH_SUPPORTS_KPROBES
+ default y
+
source "init/Kconfig"

menu "Processor type and features"
Index: kernel-13nov/arch/x86/Kconfig.x86_64
===================================================================
--- kernel-13nov.orig/arch/x86/Kconfig.x86_64
+++ kernel-13nov/arch/x86/Kconfig.x86_64
@@ -139,6 +139,11 @@ config ARCH_SUPPORTS_OPROFILE
config ARCH_SUPPORTS_KPROBES
def_bool y

+config ARCH_SUPPORTS_KRETPROBES
+ bool
+ depends on ARCH_SUPPORTS_KPROBES
+ default y
+
source "init/Kconfig"


Index: kernel-13nov/include/asm-ia64/kprobes.h
===================================================================
--- kernel-13nov.orig/include/asm-ia64/kprobes.h
+++ kernel-13nov/include/asm-ia64/kprobes.h
@@ -82,7 +82,6 @@ struct kprobe_ctlblk {
struct prev_kprobe prev_kprobe[ARCH_PREV_KPROBE_SZ];
};

-#define ARCH_SUPPORTS_KRETPROBES
#define kretprobe_blacklist_size 0

#define SLOT0_OPCODE_SHIFT (37)
Index: kernel-13nov/include/asm-powerpc/kprobes.h
===================================================================
--- kernel-13nov.orig/include/asm-powerpc/kprobes.h
+++ kernel-13nov/include/asm-powerpc/kprobes.h
@@ -80,7 +80,6 @@ typedef unsigned int kprobe_opcode_t;
#define is_trap(instr) (IS_TW(instr) || IS_TWI(instr))
#endif

-#define ARCH_SUPPORTS_KRETPROBES
#define flush_insn_slot(p) do { } while (0)
#define kretprobe_blacklist_size 0

Index: kernel-13nov/include/asm-s390/kprobes.h
===================================================================
--- kernel-13nov.orig/include/asm-s390/kprobes.h
+++ kernel-13nov/include/asm-s390/kprobes.h
@@ -46,7 +46,6 @@ typedef u16 kprobe_opcode_t;
? (MAX_STACK_SIZE) \
: (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR)))

-#define ARCH_SUPPORTS_KRETPROBES
#define kretprobe_blacklist_size 0

#define KPROBE_SWAP_INST 0x10
Index: kernel-13nov/include/asm-x86/kprobes_32.h
===================================================================
--- kernel-13nov.orig/include/asm-x86/kprobes_32.h
+++ kernel-13nov/include/asm-x86/kprobes_32.h
@@ -42,7 +42,6 @@ typedef u8 kprobe_opcode_t;
? (MAX_STACK_SIZE) \
: (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR)))

-#define ARCH_SUPPORTS_KRETPROBES
#define flush_insn_slot(p) do { } while (0)

extern const int kretprobe_blacklist_size;
Index: kernel-13nov/include/asm-x86/kprobes_64.h
===================================================================
--- kernel-13nov.orig/include/asm-x86/kprobes_64.h
+++ kernel-13nov/include/asm-x86/kprobes_64.h
@@ -41,7 +41,6 @@ typedef u8 kprobe_opcode_t;
? (MAX_STACK_SIZE) \
: (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR)))

-#define ARCH_SUPPORTS_KRETPROBES
extern const int kretprobe_blacklist_size;

void kretprobe_trampoline(void);
Index: kernel-13nov/include/linux/kprobes.h
===================================================================
--- kernel-13nov.orig/include/linux/kprobes.h
+++ kernel-13nov/include/linux/kprobes.h
@@ -125,11 +125,11 @@ struct jprobe {
DECLARE_PER_CPU(struct kprobe *, current_kprobe);
DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);

-#ifdef ARCH_SUPPORTS_KRETPROBES
+#ifdef CONFIG_ARCH_SUPPORTS_KRETPROBES
extern void arch_prepare_kretprobe(struct kretprobe_instance *ri,
struct pt_regs *regs);
extern int arch_trampoline_kprobe(struct kprobe *p);
-#else /* ARCH_SUPPORTS_KRETPROBES */
+#else /* CONFIG_ARCH_SUPPORTS_KRETPROBES */
static inline void arch_prepare_kretprobe(struct kretprobe *rp,
struct pt_regs *regs)
{
@@ -138,7 +138,7 @@ static inline int arch_trampoline_kprobe
{
return 0;
}
-#endif /* ARCH_SUPPORTS_KRETPROBES */
+#endif /* CONFIG_ARCH_SUPPORTS_KRETPROBES */
/*
* Function-return probe -
* Note:
Index: kernel-13nov/kernel/kprobes.c
===================================================================
--- kernel-13nov.orig/kernel/kprobes.c
+++ kernel-13nov/kernel/kprobes.c
@@ -678,7 +678,7 @@ void __kprobes unregister_jprobe(struct
unregister_kprobe(&jp->kp);
}

-#ifdef ARCH_SUPPORTS_KRETPROBES
+#ifdef CONFIG_ARCH_SUPPORTS_KRETPROBES

/*
* This kprobe pre_handler is registered with every kretprobe. When probe
@@ -762,7 +762,7 @@ int __kprobes register_kretprobe(struct
return ret;
}

-#else /* ARCH_SUPPORTS_KRETPROBES */
+#else /* CONFIG_ARCH_SUPPORTS_KRETPROBES */

int __kprobes register_kretprobe(struct kretprobe *rp)
{
@@ -775,7 +775,7 @@ static int __kprobes pre_handler_kretpro
return 0;
}

-#endif /* ARCH_SUPPORTS_KRETPROBES */
+#endif /* CONFIG_ARCH_SUPPORTS_KRETPROBES */

void __kprobes unregister_kretprobe(struct kretprobe *rp)
{
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2007-11-13 16:49    [from the cache]
©2003-2011 Jasper Spaans