From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org,
anil.s.keshavamurthy@intel.com, davem@davemloft.net,
ananth@in.ibm.com, masami.hiramatsu.pt@hitachi.com,
ak@linux.intel.com, tglx@linutronix.de, hpa@linux.intel.com
Cc: tip-bot for Andi Kleen <tipbot@zytor.com>,
linux-tip-commits@vger.kernel.org
Subject: Re: [tip:x86/asmlinkage] x86, asmlinkage: Make kprobes code visible and fix assembler code
Date: Wed, 07 Aug 2013 12:55:38 +0900 [thread overview]
Message-ID: <5201C53A.203@hitachi.com> (raw)
In-Reply-To: <tip-04bb591ca74fb8ea06d5ab7fadfb7bf5b11fb28e@git.kernel.org>
(2013/08/07 6:43), tip-bot for Andi Kleen wrote:
> Commit-ID: 04bb591ca74fb8ea06d5ab7fadfb7bf5b11fb28e
> Gitweb: http://git.kernel.org/tip/04bb591ca74fb8ea06d5ab7fadfb7bf5b11fb28e
> Author: Andi Kleen <ak@linux.intel.com>
> AuthorDate: Mon, 5 Aug 2013 15:02:41 -0700
> Committer: H. Peter Anvin <hpa@linux.intel.com>
> CommitDate: Tue, 6 Aug 2013 14:19:48 -0700
>
> x86, asmlinkage: Make kprobes code visible and fix assembler code
>
> - Make all the external assembler template symbols __visible
> - Move the templates inline assembler code into a top level
> assembler statement, not inside a function. This avoids it being
> optimized away or cloned.
Oh, I didn't know that I can use asm() at top level. Thanks!
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> Link: http://lkml.kernel.org/r/1375740170-7446-8-git-send-email-andi@firstfloor.org
> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
> ---
> arch/x86/include/asm/kprobes.h | 10 +++++-----
> arch/x86/kernel/kprobes/core.c | 2 +-
> arch/x86/kernel/kprobes/opt.c | 5 +----
> 3 files changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/include/asm/kprobes.h b/arch/x86/include/asm/kprobes.h
> index 5a6d287..9454c16 100644
> --- a/arch/x86/include/asm/kprobes.h
> +++ b/arch/x86/include/asm/kprobes.h
> @@ -49,10 +49,10 @@ typedef u8 kprobe_opcode_t;
> #define flush_insn_slot(p) do { } while (0)
>
> /* optinsn template addresses */
> -extern kprobe_opcode_t optprobe_template_entry;
> -extern kprobe_opcode_t optprobe_template_val;
> -extern kprobe_opcode_t optprobe_template_call;
> -extern kprobe_opcode_t optprobe_template_end;
> +extern __visible kprobe_opcode_t optprobe_template_entry;
> +extern __visible kprobe_opcode_t optprobe_template_val;
> +extern __visible kprobe_opcode_t optprobe_template_call;
> +extern __visible kprobe_opcode_t optprobe_template_end;
> #define MAX_OPTIMIZED_LENGTH (MAX_INSN_SIZE + RELATIVE_ADDR_SIZE)
> #define MAX_OPTINSN_SIZE \
> (((unsigned long)&optprobe_template_end - \
> @@ -62,7 +62,7 @@ extern kprobe_opcode_t optprobe_template_end;
> extern const int kretprobe_blacklist_size;
>
> void arch_remove_kprobe(struct kprobe *p);
> -void kretprobe_trampoline(void);
> +asmlinkage void kretprobe_trampoline(void);
>
> /* Architecture specific copy of original instruction*/
> struct arch_specific_insn {
> diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
> index 211bce4..048852d 100644
> --- a/arch/x86/kernel/kprobes/core.c
> +++ b/arch/x86/kernel/kprobes/core.c
> @@ -661,7 +661,7 @@ static void __used __kprobes kretprobe_trampoline_holder(void)
> /*
> * Called from kretprobe_trampoline
> */
> -static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
> +__visible __used __kprobes void *trampoline_handler(struct pt_regs *regs)
> {
> struct kretprobe_instance *ri = NULL;
> struct hlist_head *head, empty_rp;
> diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
> index 76dc6f0..2c1ac28 100644
> --- a/arch/x86/kernel/kprobes/opt.c
> +++ b/arch/x86/kernel/kprobes/opt.c
> @@ -88,9 +88,7 @@ static void __kprobes synthesize_set_arg1(kprobe_opcode_t *addr, unsigned long v
> *(unsigned long *)addr = val;
> }
>
> -static void __used __kprobes kprobes_optinsn_template_holder(void)
> -{
> - asm volatile (
> +asm (
> ".global optprobe_template_entry\n"
> "optprobe_template_entry:\n"
> #ifdef CONFIG_X86_64
> @@ -129,7 +127,6 @@ static void __used __kprobes kprobes_optinsn_template_holder(void)
> #endif
> ".global optprobe_template_end\n"
> "optprobe_template_end:\n");
> -}
>
> #define TMPL_MOVE_IDX \
> ((long)&optprobe_template_val - (long)&optprobe_template_entry)
--
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com
next prev parent reply other threads:[~2013-08-07 3:55 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-05 22:02 x86: Clean up asmlinkage use Andi Kleen
2013-08-05 22:02 ` [PATCH 01/16] x86: Fix sys_call_table type in asm/syscall.h v2 Andi Kleen
2013-08-06 21:42 ` [tip:x86/asmlinkage] x86: Fix sys_call_table type in asm/ syscall.h tip-bot for Andi Kleen
2013-08-05 22:02 ` [PATCH 02/16] x86, asmlinkage: Change dotraplinkage into __visible on 32bit v2 Andi Kleen
2013-08-06 21:42 ` [tip:x86/asmlinkage] x86, asmlinkage: Change dotraplinkage into __visible on 32bit tip-bot for Andi Kleen
2013-08-05 22:02 ` [PATCH 03/16] x86, asmlinkage: Make all interrupt handlers asmlinkage / __visible Andi Kleen
2013-08-06 21:07 ` H. Peter Anvin
2013-08-06 21:24 ` H. Peter Anvin
2013-08-06 21:43 ` [tip:x86/asmlinkage] " tip-bot for Andi Kleen
2013-08-05 22:02 ` [PATCH 04/16] x86, asmlinkage: Make _*_start_kernel visible Andi Kleen
2013-08-06 21:43 ` [tip:x86/asmlinkage] " tip-bot for Andi Kleen
2013-08-05 22:02 ` [PATCH 05/16] x86, asmlinkage: Make 32bit/64bit __switch_to visible Andi Kleen
2013-08-06 21:43 ` [tip:x86/asmlinkage] x86, asmlinkage: Make 32bit/ 64bit " tip-bot for Andi Kleen
2013-08-05 22:02 ` [PATCH 06/16] x86, asmlinkage: Make various syscalls asmlinkage Andi Kleen
2013-08-06 21:43 ` [tip:x86/asmlinkage] " tip-bot for Andi Kleen
2013-08-05 22:02 ` [PATCH 07/16] x86, asmlinkage: Make kprobes code visible and fix assembler code Andi Kleen
2013-08-06 21:43 ` [tip:x86/asmlinkage] " tip-bot for Andi Kleen
2013-08-07 3:55 ` Masami Hiramatsu [this message]
2013-08-05 22:02 ` [PATCH 08/16] x86, asmlinkage, kexec: Drop bogus asmlinkage in machine_kexec_32 Andi Kleen
2013-08-05 23:03 ` H. Peter Anvin
2013-08-05 23:10 ` Andi Kleen
2013-08-05 22:02 ` [PATCH 09/16] x86, asmlinkage: Make several variables used from assembler/linker script visible Andi Kleen
2013-08-06 21:43 ` [tip:x86/asmlinkage] " tip-bot for Andi Kleen
2013-08-05 22:02 ` [PATCH 10/16] x86, asmlinkage: Make syscall tables visible Andi Kleen
2013-08-06 21:44 ` [tip:x86/asmlinkage] " tip-bot for Andi Kleen
2013-08-05 22:02 ` [PATCH 11/16] x86, asmlinkage, apm: Make APM data structure used from assembler visible Andi Kleen
2013-08-06 21:44 ` [tip:x86/asmlinkage] " tip-bot for Andi Kleen
2013-08-05 22:02 ` [PATCH 12/16] x86, asmlinkage, paravirt: Add __visible/asmlinkage to xen paravirt ops Andi Kleen
2013-08-06 21:44 ` [tip:x86/asmlinkage] x86, asmlinkage, paravirt: Add __visible/ asmlinkage " tip-bot for Andi Kleen
2013-08-05 22:02 ` [PATCH 13/16] x86, asmlinkage: Make 64bit checksum functions visible Andi Kleen
2013-08-06 21:44 ` [tip:x86/asmlinkage] " tip-bot for Andi Kleen
2013-08-05 22:02 ` [PATCH 14/16] x86, asmlinkage: Make dump_stack visible Andi Kleen
2013-08-06 21:44 ` [tip:x86/asmlinkage] " tip-bot for Andi Kleen
2013-08-05 22:02 ` [PATCH 15/16] x86, asmlinkage, power: Make various symbols used by the suspend asm code visible Andi Kleen
2013-08-06 21:44 ` [tip:x86/asmlinkage] " tip-bot for Andi Kleen
2013-08-05 22:02 ` [PATCH 16/16] x86, asmlinkage, vdso: Mark vdso variables __visible Andi Kleen
2013-08-06 21:45 ` [tip:x86/asmlinkage] " tip-bot for Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5201C53A.203@hitachi.com \
--to=masami.hiramatsu.pt@hitachi.com \
--cc=ak@linux.intel.com \
--cc=ananth@in.ibm.com \
--cc=anil.s.keshavamurthy@intel.com \
--cc=davem@davemloft.net \
--cc=hpa@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=tipbot@zytor.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox