[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1420616133-42855-1-git-send-email-wangnan0@huawei.com>
Date: Wed, 7 Jan 2015 15:35:33 +0800
From: Wang Nan <wangnan0@...wei.com>
To: <linux@....linux.org.uk>, <mingo@...hat.com>, <x86@...nel.org>,
<masami.hiramatsu.pt@...achi.com>,
<anil.s.keshavamurthy@...el.com>, <davem@...emloft.net>,
<ananth@...ibm.com>, <dave.long@...aro.org>, <tixy@...aro.org>
CC: <lizefan@...wei.com>, <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: [RFC PATCH 03/11] x86: kprobes: directly modify code if kprobe is not initialized.
When registering early kprobes, SMP should has not been enabled, so
doesn't require synchronization in text_poke_bp(). Simply memcpy is
enough.
Signed-off-by: Wang Nan <wangnan0@...wei.com>
---
arch/x86/kernel/kprobes/opt.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
index 0dd8d08..dc5fccb 100644
--- a/arch/x86/kernel/kprobes/opt.c
+++ b/arch/x86/kernel/kprobes/opt.c
@@ -397,8 +397,11 @@ 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_initialized))
+ memcpy(op->kp.addr, insn_buf, RELATIVEJUMP_SIZE);
+ else
+ text_poke_bp(op->kp.addr, insn_buf, RELATIVEJUMP_SIZE,
+ op->optinsn.insn);
list_del_init(&op->list);
}
--
1.8.4
--
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