This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH -tip v8 14/26] x86: Use NOKPROBE_SYMBOL() instead of __kprobes annotation
- From: Steven Rostedt <rostedt at goodmis dot org>
- To: Masami Hiramatsu <masami dot hiramatsu dot pt at hitachi dot com>
- Cc: linux-kernel at vger dot kernel dot org, Ingo Molnar <mingo at kernel dot org>, Andi Kleen <ak at linux dot intel dot com>, Andi Kleen <andi at firstfloor dot org>, Peter Zijlstra <a dot p dot zijlstra at chello dot nl>, Sandeepa Prabhu <sandeepa dot prabhu at linaro dot org>, Frederic Weisbecker <fweisbec at gmail dot com>, x86 at kernel dot org, Oleg Nesterov <oleg at redhat dot com>, fche at redhat dot com, mingo at redhat dot com, Arnaldo Carvalho de Melo <acme at ghostprotocols dot net>, "H. Peter Anvin" <hpa at zytor dot com>, Thomas Gleixner <tglx at linutronix dot de>, Seiji Aguchi <seiji dot aguchi at hds dot com>, systemtap at sourceware dot org, Ananth N Mavinakayanahalli <ananth at in dot ibm dot com>
- Date: Mon, 24 Mar 2014 15:45:18 -0400
- Subject: Re: [PATCH -tip v8 14/26] x86: Use NOKPROBE_SYMBOL() instead of __kprobes annotation
- Authentication-results: sourceware.org; auth=none
- References: <20140305115843 dot 22766 dot 8355 dot stgit at ltc230 dot yrl dot intra dot hitachi dot co dot jp> <20140305120021 dot 22766 dot 59 dot stgit at ltc230 dot yrl dot intra dot hitachi dot co dot jp>
On Wed, 05 Mar 2014 21:00:21 +0900
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> wrote:
> /*
> * This is gone through when something in the kernel has done something bad
> diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
> index ae5aafb..d00103a 100644
> --- a/arch/x86/kernel/kprobes/core.c
> +++ b/arch/x86/kernel/kprobes/core.c
> @@ -112,7 +112,8 @@ struct kretprobe_blackpoint kretprobe_blacklist[] = {
>
> const int kretprobe_blacklist_size = ARRAY_SIZE(kretprobe_blacklist);
>
> -static void __kprobes __synthesize_relative_insn(void *from, void *to, u8 op)
> +static nokprobe_inline
> +void __synthesize_relative_insn(void *from, void *to, u8 op)
I believe the proper way to break this up is:
static nokprobe_inline void
__synthesize_relative_insn(...)
> -static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
> +static nokprobe_inline
> +void save_previous_kprobe(struct kprobe_ctlblk *kcb)
Here too.
> {
> kcb->prev_kprobe.kp = kprobe_running();
> kcb->prev_kprobe.status = kcb->kprobe_status;
> @@ -433,7 +438,8 @@ static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
> kcb->prev_kprobe.saved_flags = kcb->kprobe_saved_flags;
> }
>
> -static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
> +static nokprobe_inline
> +void restore_previous_kprobe(struct kprobe_ctlblk *kcb)
and again.
> {
> __this_cpu_write(current_kprobe, kcb->prev_kprobe.kp);
> kcb->kprobe_status = kcb->prev_kprobe.status;
> @@ -441,8 +447,9 @@ static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
> kcb->kprobe_saved_flags = kcb->prev_kprobe.saved_flags;
> }
>
> -static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
> - struct kprobe_ctlblk *kcb)
> +static nokprobe_inline
> +void set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
and again.
> + struct kprobe_ctlblk *kcb)
> {
> __this_cpu_write(current_kprobe, p);
> kcb->kprobe_saved_flags = kcb->kprobe_old_flags
> @@ -451,7 +458,7 @@ static void __kprobes set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
> kcb->kprobe_saved_flags &= ~X86_EFLAGS_IF;
> }
> diff --git a/arch/x86/kernel/kprobes/ftrace.c b/arch/x86/kernel/kprobes/ftrace.c
> index dcaa131..717b02a 100644
> --- a/arch/x86/kernel/kprobes/ftrace.c
> +++ b/arch/x86/kernel/kprobes/ftrace.c
> @@ -25,8 +25,9 @@
>
> #include "common.h"
>
> -static int __skip_singlestep(struct kprobe *p, struct pt_regs *regs,
> - struct kprobe_ctlblk *kcb)
> +static nokprobe_inline
> +int __skip_singlestep(struct kprobe *p, struct pt_regs *regs,
Here too.
> + struct kprobe_ctlblk *kcb)
> {
> /*
> * Emulate singlestep (and also recover regs->ip)
> @@ -41,18 +42,19 @@ static int __skip_singlestep(struct kprobe *p, struct pt_regs *regs,
> return 1;
> }
>
> diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
> index ba9abe9..3c8ae7d 100644
> --- a/arch/x86/kernel/traps.c
> +++ b/arch/x86/kernel/traps.c
> @@ -106,7 +106,7 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
> preempt_count_dec();
> }
>
> -static int __kprobes
> +static nokprobe_inline int
> do_trap_no_signal(struct task_struct *tsk, int trapnr, char *str,
Here you do it correctly :-)
> struct pt_regs *regs, long error_code)
> {
> @@ -136,7 +136,7 @@ do_trap_no_signal(struct task_struct *tsk, int trapnr, char *str,
> return -1;
> }
>
-- Steve