diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2015-01-05 06:29:32 -0500 |
---|---|---|
committer | Jon Medhurst <tixy@linaro.org> | 2015-01-13 11:10:16 -0500 |
commit | cbf6ab52add20b845f903decc973afbd5463c527 (patch) | |
tree | ea3dd11ef2a4f68aaf531038127aeee55c38db75 | |
parent | 8d257e95a9e643518e72232bf852b054a3d06c95 (diff) |
kprobes: Pass the original kprobe for preparing optimized kprobe
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>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rw-r--r-- | arch/x86/kernel/kprobes/opt.c | 3 | ||||
-rw-r--r-- | include/linux/kprobes.h | 3 | ||||
-rw-r--r-- | 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 7c523bbf3dc8..0dd8d089c315 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) | |||
322 | * Target instructions MUST be relocatable (checked inside) | 322 | * Target instructions MUST be relocatable (checked inside) |
323 | * This is called when new aggr(opt)probe is allocated or reused. | 323 | * This is called when new aggr(opt)probe is allocated or reused. |
324 | */ | 324 | */ |
325 | int arch_prepare_optimized_kprobe(struct optimized_kprobe *op) | 325 | int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, |
326 | struct kprobe *__unused) | ||
326 | { | 327 | { |
327 | u8 *buf; | 328 | u8 *buf; |
328 | int ret; | 329 | int ret; |
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 5297f9fa0ef2..1ab54754a86d 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h | |||
@@ -308,7 +308,8 @@ struct optimized_kprobe { | |||
308 | /* Architecture dependent functions for direct jump optimization */ | 308 | /* Architecture dependent functions for direct jump optimization */ |
309 | extern int arch_prepared_optinsn(struct arch_optimized_insn *optinsn); | 309 | extern int arch_prepared_optinsn(struct arch_optimized_insn *optinsn); |
310 | extern int arch_check_optimized_kprobe(struct optimized_kprobe *op); | 310 | extern int arch_check_optimized_kprobe(struct optimized_kprobe *op); |
311 | extern int arch_prepare_optimized_kprobe(struct optimized_kprobe *op); | 311 | extern int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, |
312 | struct kprobe *orig); | ||
312 | extern void arch_remove_optimized_kprobe(struct optimized_kprobe *op); | 313 | extern void arch_remove_optimized_kprobe(struct optimized_kprobe *op); |
313 | extern void arch_optimize_kprobes(struct list_head *oplist); | 314 | extern void arch_optimize_kprobes(struct list_head *oplist); |
314 | extern void arch_unoptimize_kprobes(struct list_head *oplist, | 315 | extern void arch_unoptimize_kprobes(struct list_head *oplist, |
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 06f58309fed2..bad4e959f2f7 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -717,7 +717,7 @@ static void prepare_optimized_kprobe(struct kprobe *p) | |||
717 | struct optimized_kprobe *op; | 717 | struct optimized_kprobe *op; |
718 | 718 | ||
719 | op = container_of(p, struct optimized_kprobe, kp); | 719 | op = container_of(p, struct optimized_kprobe, kp); |
720 | arch_prepare_optimized_kprobe(op); | 720 | arch_prepare_optimized_kprobe(op, p); |
721 | } | 721 | } |
722 | 722 | ||
723 | /* Allocate new optimized_kprobe and try to prepare optimized instructions */ | 723 | /* Allocate new optimized_kprobe and try to prepare optimized instructions */ |
@@ -731,7 +731,7 @@ static struct kprobe *alloc_aggr_kprobe(struct kprobe *p) | |||
731 | 731 | ||
732 | INIT_LIST_HEAD(&op->list); | 732 | INIT_LIST_HEAD(&op->list); |
733 | op->kp.addr = p->addr; | 733 | op->kp.addr = p->addr; |
734 | arch_prepare_optimized_kprobe(op); | 734 | arch_prepare_optimized_kprobe(op, p); |
735 | 735 | ||
736 | return &op->kp; | 736 | return &op->kp; |
737 | } | 737 | } |