Skip to content

Commit

Permalink
powerpc/kprobes: Emulate instructions on kprobe handler re-entry
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Naveen N. Rao authored and Michael Ellerman committed Apr 20, 2017
1 parent 1cabd2f commit 22d8b3d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arch/powerpc/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 22d8b3d

Please sign in to comment.