From: Masami Hiramatsu Date: Wed, 19 Apr 2017 12:52:25 +0000 (+0530) Subject: kprobes: Skip preparing optprobe if the probe is ftrace-based X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a460246c70d1ac25a0717112e7a167240c7aca1a;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git kprobes: Skip preparing optprobe if the probe is ftrace-based Skip preparing optprobe if the probe is ftrace-based, since anyway, it must not be optimized (or already optimized by ftrace). Tested-by: Naveen N. Rao Signed-off-by: Masami Hiramatsu Signed-off-by: Michael Ellerman --- diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 699c5bc51a92..d179839e1b70 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -746,13 +746,20 @@ static void kill_optimized_kprobe(struct kprobe *p) arch_remove_optimized_kprobe(op); } +static inline +void __prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *p) +{ + if (!kprobe_ftrace(p)) + arch_prepare_optimized_kprobe(op, p); +} + /* Try to prepare optimized instructions */ 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, p); + __prepare_optimized_kprobe(op, p); } /* Allocate new optimized_kprobe and try to prepare optimized instructions */ @@ -766,7 +773,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, p); + __prepare_optimized_kprobe(op, p); return &op->kp; }