summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>2017-04-19 18:21:05 +0530
committerMichael Ellerman <mpe@ellerman.id.au>2017-04-20 23:18:56 +1000
commit22d8b3dec214cd43a773f621f95d254c50d2a092 (patch)
tree8cf9983da50372af9888491d8b155c646f217edd
parent1cabd2f8f720a0ed612139547acb655495b23e8b (diff)
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 <ananth@linux.vnet.ibm.com> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/kernel/kprobes.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index ed5a917c2edd..b71922618ed2 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) {