From: Naveen N. Rao Date: Wed, 19 Apr 2017 12:51:05 +0000 (+0530) Subject: powerpc/kprobes: Emulate instructions on kprobe handler re-entry X-Git-Tag: v4.12-rc1~17^2~57^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=22d8b3dec214cd43a773f621f95d254c50d2a092;p=platform%2Fkernel%2Flinux-exynos.git powerpc/kprobes: Emulate instructions on kprobe handler re-entry On kprobe handler re-entry, try to emulate the instruction rather than single stepping always. Acked-by: Ananth N Mavinakayanahalli Signed-off-by: Naveen N. Rao Signed-off-by: Michael Ellerman --- diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index ed5a917..b719226 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c @@ -277,6 +277,14 @@ int __kprobes kprobe_handler(struct pt_regs *regs) kprobes_inc_nmissed_count(p); prepare_singlestep(p, regs); kcb->kprobe_status = KPROBE_REENTER; + if (p->ainsn.boostable >= 0) { + ret = try_to_emulate(p, regs); + + if (ret > 0) { + restore_previous_kprobe(kcb); + return 1; + } + } return 1; } else { if (*addr != BREAKPOINT_INSTRUCTION) {