[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54E6B172.7080604@hitachi.com>
Date: Fri, 20 Feb 2015 13:00:50 +0900
From: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
To: Wang Nan <wangnan0@...wei.com>
Cc: linux@....linux.org.uk, tglx@...utronix.de, mingo@...hat.com,
hpa@...or.com, rostedt@...dmis.org, ananth@...ibm.com,
anil.s.keshavamurthy@...el.com, davem@...emloft.net,
luto@...capital.net, keescook@...omium.org, oleg@...hat.com,
dave.long@...aro.org, tixy@...aro.org, nico@...aro.org,
yalin.wang2010@...il.com, catalin.marinas@....com,
Yalin.Wang@...ymobile.com, mark.rutland@....com,
dave.hansen@...ux.intel.com, jkenisto@...ibm.com, anton@...ba.org,
stefani@...bold.net, JBeulich@...e.com, akpm@...ux-foundation.org,
rusty@...tcorp.com.au, peterz@...radead.org, prarit@...hat.com,
fabf@...net.be, hannes@...xchg.org, x86@...nel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
lizefan@...wei.com,
"yrl.pp-manager.tt@...achi.com" <yrl.pp-manager.tt@...achi.com>
Subject: Re: [RFC PATCH v3 15/26] early kprobes: x86: directly modify code.
(2015/02/13 14:40), Wang Nan wrote:
> When registering early kprobes, SMP should has not been enabled, so
> doesn't require synchronization in text_poke_bp(). Simply memcpy is
> enough.
BTW, we've already have text_poke_early for this purpose.
Thank you,
>
> Signed-off-by: Wang Nan <wangnan0@...wei.com>
> ---
> arch/x86/kernel/kprobes/opt.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
> index 0dd8d08..21847ab 100644
> --- a/arch/x86/kernel/kprobes/opt.c
> +++ b/arch/x86/kernel/kprobes/opt.c
> @@ -36,6 +36,7 @@
> #include <asm/alternative.h>
> #include <asm/insn.h>
> #include <asm/debugreg.h>
> +#include <asm/tlbflush.h>
>
> #include "common.h"
>
> @@ -397,8 +398,15 @@ void arch_optimize_kprobes(struct list_head *oplist)
> insn_buf[0] = RELATIVEJUMP_OPCODE;
> *(s32 *)(&insn_buf[1]) = rel;
>
> - text_poke_bp(op->kp.addr, insn_buf, RELATIVEJUMP_SIZE,
> - op->optinsn.insn);
> + if (unlikely(kprobes_is_early())) {
> + BUG_ON(!(op->kp.flags & KPROBE_FLAG_EARLY));
> + memcpy(op->kp.addr, insn_buf, RELATIVEJUMP_SIZE);
> + local_flush_tlb();
> + sync_core();
> + } else {
> + text_poke_bp(op->kp.addr, insn_buf, RELATIVEJUMP_SIZE,
> + op->optinsn.insn);
> + }
>
> list_del_init(&op->list);
> }
>
--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@...achi.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists