linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: wangnan0@huawei.com (Wang Nan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v17 07/11] kprobes: Pass the original kprobe for preparing optimized kprobe
Date: Sat, 27 Dec 2014 15:35:33 +0800	[thread overview]
Message-ID: <1419665733-13150-1-git-send-email-wangnan0@huawei.com> (raw)
In-Reply-To: <1419665637-12744-1-git-send-email-wangnan0@huawei.com>

From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>

Pass the original kprobe for preparing an optimized kprobe arch-dep
part, since for some architecture (e.g. ARM32) requires the information
in original kprobe.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Wang Nan <wangnan0@huawei.com>
---
 arch/x86/kernel/kprobes/opt.c | 3 ++-
 include/linux/kprobes.h       | 3 ++-
 kernel/kprobes.c              | 4 ++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
index 7c523bb..0dd8d08 100644
--- a/arch/x86/kernel/kprobes/opt.c
+++ b/arch/x86/kernel/kprobes/opt.c
@@ -322,7 +322,8 @@ void arch_remove_optimized_kprobe(struct optimized_kprobe *op)
  * Target instructions MUST be relocatable (checked inside)
  * This is called when new aggr(opt)probe is allocated or reused.
  */
-int arch_prepare_optimized_kprobe(struct optimized_kprobe *op)
+int arch_prepare_optimized_kprobe(struct optimized_kprobe *op,
+				  struct kprobe *__unused)
 {
 	u8 *buf;
 	int ret;
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 5297f9f..1ab5475 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -308,7 +308,8 @@ struct optimized_kprobe {
 /* Architecture dependent functions for direct jump optimization */
 extern int arch_prepared_optinsn(struct arch_optimized_insn *optinsn);
 extern int arch_check_optimized_kprobe(struct optimized_kprobe *op);
-extern int arch_prepare_optimized_kprobe(struct optimized_kprobe *op);
+extern int arch_prepare_optimized_kprobe(struct optimized_kprobe *op,
+					 struct kprobe *orig);
 extern void arch_remove_optimized_kprobe(struct optimized_kprobe *op);
 extern void arch_optimize_kprobes(struct list_head *oplist);
 extern void arch_unoptimize_kprobes(struct list_head *oplist,
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 06f5830..bad4e95 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -717,7 +717,7 @@ static void prepare_optimized_kprobe(struct kprobe *p)
 	struct optimized_kprobe *op;
 
 	op = container_of(p, struct optimized_kprobe, kp);
-	arch_prepare_optimized_kprobe(op);
+	arch_prepare_optimized_kprobe(op, p);
 }
 
 /* Allocate new optimized_kprobe and try to prepare optimized instructions */
@@ -731,7 +731,7 @@ static struct kprobe *alloc_aggr_kprobe(struct kprobe *p)
 
 	INIT_LIST_HEAD(&op->list);
 	op->kp.addr = p->addr;
-	arch_prepare_optimized_kprobe(op);
+	arch_prepare_optimized_kprobe(op, p);
 
 	return &op->kp;
 }
-- 
1.8.4

  parent reply	other threads:[~2014-12-27  7:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-27  7:33 [PATCH v17 00/11] ARM: kprobes: OPTPROBES and other improvements Wang Nan
2014-12-27  7:34 ` [PATCH v17 01/11] ARM: probes: move all probe code to dedicate directory Wang Nan
2014-12-27  7:34 ` [PATCH v17 02/11] ARM: kprobes: remove unused ARM decoder actions Wang Nan
2014-12-27  7:35 ` [PATCH v17 03/11] ARM: kprobes: introduces checker Wang Nan
2014-12-27  7:35 ` [PATCH v17 04/11] ARM: kprobes: collects stack consumption for store instructions Wang Nan
2014-12-27  7:35 ` [PATCH v17 05/11] ARM: kprobes: disallow probing stack consuming instructions Wang Nan
2014-12-27  7:35 ` [PATCH v17 06/11] ARM: kprobes: Add test cases for " Wang Nan
2014-12-27  7:35 ` Wang Nan [this message]
2014-12-27  7:35 ` [PATCH v17 08/11] ARM: kprobes: enable OPTPROBES for ARM 32 Wang Nan
2014-12-27  7:35 ` [PATCH v17 09/11] ARM: kprobes: Fix unreliable MRS instruction tests Wang Nan
2014-12-27  7:35 ` [PATCH v17 10/11] ARM: kprobes: check register usage for probed instruction Wang Nan
2014-12-27  7:36 ` [PATCH v17 11/11] ARM: optprobes: execute instruction during restoring if possible Wang Nan
2014-12-28 22:10   ` Masami Hiramatsu
2014-12-29  4:07     ` [PATCH v18 10/11] ARM: kprobes: check register usage for probed instruction Wang Nan
2015-01-04  5:05       ` Masami Hiramatsu
2015-01-04  5:16         ` Wang Nan
2014-12-29  4:07     ` [PATCH v18 11/11] ARM: optprobes: execute instruction during restoring if possible Wang Nan
2015-01-04  5:25       ` Masami Hiramatsu
2014-12-29  4:10     ` [PATCH v17 " Wang Nan

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=1419665733-13150-1-git-send-email-wangnan0@huawei.com \
    --to=wangnan0@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).