linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][bugfix] kprobes: fix module compilation error with CONFIG_KPROBES=n
@ 2009-01-05 22:23 Masami Hiramatsu
  2009-01-06 16:39 ` Masami Hiramatsu
  2009-01-14  8:32 ` Andrew Morton
  0 siblings, 2 replies; 6+ messages in thread
From: Masami Hiramatsu @ 2009-01-05 22:23 UTC (permalink / raw)
  To: Ananth N Mavinakayanahalli, Andrew Morton
  Cc: Jim Keniston, David Miller, LKML, systemtap-ml

Define kprobes related data structures even if CONFIG_KPROBES is not set.
This fixes compilation errors which occur if CONFIG_KPROBES is not set, in
kprobe using modules.

Reviewed-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
---
 include/linux/kprobes.h |   45 +++++++++++++++++++++++----------------------
 1 file changed, 23 insertions(+), 22 deletions(-)

Index: 2.6.28/include/linux/kprobes.h
===================================================================
--- 2.6.28.orig/include/linux/kprobes.h
+++ 2.6.28/include/linux/kprobes.h
@@ -37,9 +37,9 @@
 #include <linux/spinlock.h>
 #include <linux/rcupdate.h>
 #include <linux/mutex.h>
+#include <asm/kprobes.h>

 #ifdef CONFIG_KPROBES
-#include <asm/kprobes.h>

 /* kprobe_status settings */
 #define KPROBE_HIT_ACTIVE	0x00000001
@@ -49,6 +49,9 @@

 /* Attach to insert probes on any functions which should be ignored*/
 #define __kprobes	__attribute__((__section__(".kprobes.text"))) notrace
+#else /* CONFIG_KPROBES */
+#define __kprobes	notrace
+#endif /* CONFIG_KPROBES */

 struct kprobe;
 struct pt_regs;
@@ -131,23 +134,6 @@ struct jprobe {
 /* For backward compatibility with old code using JPROBE_ENTRY() */
 #define JPROBE_ENTRY(handler)	(handler)

-DECLARE_PER_CPU(struct kprobe *, current_kprobe);
-DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
-
-#ifdef CONFIG_KRETPROBES
-extern void arch_prepare_kretprobe(struct kretprobe_instance *ri,
-				   struct pt_regs *regs);
-extern int arch_trampoline_kprobe(struct kprobe *p);
-#else /* CONFIG_KRETPROBES */
-static inline void arch_prepare_kretprobe(struct kretprobe *rp,
-					struct pt_regs *regs)
-{
-}
-static inline int arch_trampoline_kprobe(struct kprobe *p)
-{
-	return 0;
-}
-#endif /* CONFIG_KRETPROBES */
 /*
  * Function-return probe -
  * Note:
@@ -188,6 +174,25 @@ struct kprobe_blackpoint {
 	unsigned long range;
 };

+#ifdef CONFIG_KPROBES
+DECLARE_PER_CPU(struct kprobe *, current_kprobe);
+DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
+
+#ifdef CONFIG_KRETPROBES
+extern void arch_prepare_kretprobe(struct kretprobe_instance *ri,
+				   struct pt_regs *regs);
+extern int arch_trampoline_kprobe(struct kprobe *p);
+#else /* CONFIG_KRETPROBES */
+static inline void arch_prepare_kretprobe(struct kretprobe *rp,
+					struct pt_regs *regs)
+{
+}
+static inline int arch_trampoline_kprobe(struct kprobe *p)
+{
+	return 0;
+}
+#endif /* CONFIG_KRETPROBES */
+
 extern struct kretprobe_blackpoint kretprobe_blacklist[];

 static inline void kretprobe_assert(struct kretprobe_instance *ri,
@@ -264,10 +269,6 @@ void recycle_rp_inst(struct kretprobe_in

 #else /* CONFIG_KPROBES */

-#define __kprobes	notrace
-struct jprobe;
-struct kretprobe;
-
 static inline struct kprobe *get_kprobe(void *addr)
 {
 	return NULL;
-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][bugfix] kprobes: fix module compilation error with CONFIG_KPROBES=n
  2009-01-05 22:23 [PATCH][bugfix] kprobes: fix module compilation error with CONFIG_KPROBES=n Masami Hiramatsu
@ 2009-01-06 16:39 ` Masami Hiramatsu
  2009-01-12 22:51   ` Andrew Morton
  2009-01-14  8:32 ` Andrew Morton
  1 sibling, 1 reply; 6+ messages in thread
From: Masami Hiramatsu @ 2009-01-06 16:39 UTC (permalink / raw)
  To: Ananth N Mavinakayanahalli, Andrew Morton
  Cc: Jim Keniston, David Miller, LKML, systemtap-ml

Oops, this patch was actually for -mm tree.

Masami Hiramatsu wrote:
> Define kprobes related data structures even if CONFIG_KPROBES is not set.
> This fixes compilation errors which occur if CONFIG_KPROBES is not set, in
> kprobe using modules.
> 
> Reviewed-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
> ---
>  include/linux/kprobes.h |   45 +++++++++++++++++++++++----------------------
>  1 file changed, 23 insertions(+), 22 deletions(-)
> 
> Index: 2.6.28/include/linux/kprobes.h
> ===================================================================
> --- 2.6.28.orig/include/linux/kprobes.h
> +++ 2.6.28/include/linux/kprobes.h
> @@ -37,9 +37,9 @@
>  #include <linux/spinlock.h>
>  #include <linux/rcupdate.h>
>  #include <linux/mutex.h>
> +#include <asm/kprobes.h>
> 
>  #ifdef CONFIG_KPROBES
> -#include <asm/kprobes.h>
> 
>  /* kprobe_status settings */
>  #define KPROBE_HIT_ACTIVE	0x00000001
> @@ -49,6 +49,9 @@
> 
>  /* Attach to insert probes on any functions which should be ignored*/
>  #define __kprobes	__attribute__((__section__(".kprobes.text"))) notrace
> +#else /* CONFIG_KPROBES */
> +#define __kprobes	notrace
> +#endif /* CONFIG_KPROBES */
> 
>  struct kprobe;
>  struct pt_regs;
> @@ -131,23 +134,6 @@ struct jprobe {
>  /* For backward compatibility with old code using JPROBE_ENTRY() */
>  #define JPROBE_ENTRY(handler)	(handler)
> 
> -DECLARE_PER_CPU(struct kprobe *, current_kprobe);
> -DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
> -
> -#ifdef CONFIG_KRETPROBES
> -extern void arch_prepare_kretprobe(struct kretprobe_instance *ri,
> -				   struct pt_regs *regs);
> -extern int arch_trampoline_kprobe(struct kprobe *p);
> -#else /* CONFIG_KRETPROBES */
> -static inline void arch_prepare_kretprobe(struct kretprobe *rp,
> -					struct pt_regs *regs)
> -{
> -}
> -static inline int arch_trampoline_kprobe(struct kprobe *p)
> -{
> -	return 0;
> -}
> -#endif /* CONFIG_KRETPROBES */
>  /*
>   * Function-return probe -
>   * Note:
> @@ -188,6 +174,25 @@ struct kprobe_blackpoint {
>  	unsigned long range;
>  };
> 
> +#ifdef CONFIG_KPROBES
> +DECLARE_PER_CPU(struct kprobe *, current_kprobe);
> +DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
> +
> +#ifdef CONFIG_KRETPROBES
> +extern void arch_prepare_kretprobe(struct kretprobe_instance *ri,
> +				   struct pt_regs *regs);
> +extern int arch_trampoline_kprobe(struct kprobe *p);
> +#else /* CONFIG_KRETPROBES */
> +static inline void arch_prepare_kretprobe(struct kretprobe *rp,
> +					struct pt_regs *regs)
> +{
> +}
> +static inline int arch_trampoline_kprobe(struct kprobe *p)
> +{
> +	return 0;
> +}
> +#endif /* CONFIG_KRETPROBES */
> +
>  extern struct kretprobe_blackpoint kretprobe_blacklist[];
> 
>  static inline void kretprobe_assert(struct kretprobe_instance *ri,
> @@ -264,10 +269,6 @@ void recycle_rp_inst(struct kretprobe_in
> 
>  #else /* CONFIG_KPROBES */
> 
> -#define __kprobes	notrace
> -struct jprobe;
> -struct kretprobe;
> -
>  static inline struct kprobe *get_kprobe(void *addr)
>  {
>  	return NULL;

-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][bugfix] kprobes: fix module compilation error with CONFIG_KPROBES=n
  2009-01-06 16:39 ` Masami Hiramatsu
@ 2009-01-12 22:51   ` Andrew Morton
  2009-01-13  1:34     ` Masami Hiramatsu
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2009-01-12 22:51 UTC (permalink / raw)
  To: Masami Hiramatsu; +Cc: ananth, jkenisto, davem, linux-kernel, systemtap

On Tue, 06 Jan 2009 11:39:39 -0500
Masami Hiramatsu <mhiramat@redhat.com> wrote:

> Masami Hiramatsu wrote:
>
> > Define kprobes related data structures even if CONFIG_KPROBES is not set.
> > This fixes compilation errors which occur if CONFIG_KPROBES is not set, in
> > kprobe using modules.
> > 
>
> Oops, this patch was actually for -mm tree.
> 

I assume it's needed in mainline now.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][bugfix] kprobes: fix module compilation error with CONFIG_KPROBES=n
  2009-01-12 22:51   ` Andrew Morton
@ 2009-01-13  1:34     ` Masami Hiramatsu
  0 siblings, 0 replies; 6+ messages in thread
From: Masami Hiramatsu @ 2009-01-13  1:34 UTC (permalink / raw)
  To: Andrew Morton; +Cc: ananth, jkenisto, davem, linux-kernel, systemtap

Andrew Morton wrote:
> On Tue, 06 Jan 2009 11:39:39 -0500
> Masami Hiramatsu <mhiramat@redhat.com> wrote:
> 
>> Masami Hiramatsu wrote:
>>
>>> Define kprobes related data structures even if CONFIG_KPROBES is not set.
>>> This fixes compilation errors which occur if CONFIG_KPROBES is not set, in
>>> kprobe using modules.
>>>
>> Oops, this patch was actually for -mm tree.
>>
> 
> I assume it's needed in mainline now.

Agreed.

Thank you,

-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][bugfix] kprobes: fix module compilation error with CONFIG_KPROBES=n
  2009-01-05 22:23 [PATCH][bugfix] kprobes: fix module compilation error with CONFIG_KPROBES=n Masami Hiramatsu
  2009-01-06 16:39 ` Masami Hiramatsu
@ 2009-01-14  8:32 ` Andrew Morton
  2009-01-14 16:31   ` Masami Hiramatsu
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2009-01-14  8:32 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: Ananth N Mavinakayanahalli, Jim Keniston, David Miller, LKML,
	systemtap-ml

On Mon, 05 Jan 2009 17:23:05 -0500 Masami Hiramatsu <mhiramat@redhat.com> wrote:

> Define kprobes related data structures even if CONFIG_KPROBES is not set.
> This fixes compilation errors which occur if CONFIG_KPROBES is not set, in
> kprobe using modules.
> 
> Reviewed-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
> ---
>  include/linux/kprobes.h |   45 +++++++++++++++++++++++----------------------
>  1 file changed, 23 insertions(+), 22 deletions(-)
> 
> Index: 2.6.28/include/linux/kprobes.h
> ===================================================================
> --- 2.6.28.orig/include/linux/kprobes.h
> +++ 2.6.28/include/linux/kprobes.h
> @@ -37,9 +37,9 @@
>  #include <linux/spinlock.h>
>  #include <linux/rcupdate.h>
>  #include <linux/mutex.h>
> +#include <asm/kprobes.h>
> 
>  #ifdef CONFIG_KPROBES
> -#include <asm/kprobes.h>
> 

The above change breaks alpha, and any other architecture which has no
asm/kprobes.h.

I undid that change, but maybe that rebroke things?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][bugfix] kprobes: fix module compilation error with CONFIG_KPROBES=n
  2009-01-14  8:32 ` Andrew Morton
@ 2009-01-14 16:31   ` Masami Hiramatsu
  0 siblings, 0 replies; 6+ messages in thread
From: Masami Hiramatsu @ 2009-01-14 16:31 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Ananth N Mavinakayanahalli, Jim Keniston, David Miller, LKML,
	systemtap-ml

Andrew Morton wrote:
> On Mon, 05 Jan 2009 17:23:05 -0500 Masami Hiramatsu <mhiramat@redhat.com> wrote:
> 
>> Define kprobes related data structures even if CONFIG_KPROBES is not set.
>> This fixes compilation errors which occur if CONFIG_KPROBES is not set, in
>> kprobe using modules.
>>
>> Reviewed-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
>> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
>> ---
>>  include/linux/kprobes.h |   45 +++++++++++++++++++++++----------------------
>>  1 file changed, 23 insertions(+), 22 deletions(-)
>>
>> Index: 2.6.28/include/linux/kprobes.h
>> ===================================================================
>> --- 2.6.28.orig/include/linux/kprobes.h
>> +++ 2.6.28/include/linux/kprobes.h
>> @@ -37,9 +37,9 @@
>>  #include <linux/spinlock.h>
>>  #include <linux/rcupdate.h>
>>  #include <linux/mutex.h>
>> +#include <asm/kprobes.h>
>>
>>  #ifdef CONFIG_KPROBES
>> -#include <asm/kprobes.h>
>>
> 
> The above change breaks alpha, and any other architecture which has no
> asm/kprobes.h.

Oops, indeed. Thank you for finding it!

> I undid that change, but maybe that rebroke things?

Yes, some structures should be defined in asm/kprobes.h, so
here is an additional fix patch.

------------------------------------------------------
From: Masami Hiramatsu <mhiramat@redhat.com>

Add dummy definitions of kprobe_opcode_t and arch_specific_insn
when CONFIG_KPROBES=n.

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
---
 include/linux/kprobes.h |    4 ++++
 1 file changed, 4 insertions(+)

Index: 2.6-mm/include/linux/kprobes.h
===================================================================
--- 2.6-mm.orig/include/linux/kprobes.h
+++ 2.6-mm/include/linux/kprobes.h
@@ -50,6 +50,10 @@
 /* Attach to insert probes on any functions which should be ignored*/
 #define __kprobes	__attribute__((__section__(".kprobes.text"))) notrace
 #else /* CONFIG_KPROBES */
+typedef int kprobe_opcode_t;
+struct arch_specific_insn {
+	int dummy;
+};
 #define __kprobes	notrace
 #endif /* CONFIG_KPROBES */


-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-01-14 16:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-05 22:23 [PATCH][bugfix] kprobes: fix module compilation error with CONFIG_KPROBES=n Masami Hiramatsu
2009-01-06 16:39 ` Masami Hiramatsu
2009-01-12 22:51   ` Andrew Morton
2009-01-13  1:34     ` Masami Hiramatsu
2009-01-14  8:32 ` Andrew Morton
2009-01-14 16:31   ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).