Commit 0ccde0a2 authored by Ananth N Mavinakayanahalli's avatar Ananth N Mavinakayanahalli Committed by Paul Mackerras

[PATCH] powerpc/kprobes: fix singlestep out-of-line

We currently single-step inline if the instruction on which a kprobe is
inserted is a trap variant.

- variants (such as tdnei, used by BUG()) typically evaluate a condition
  and cause a trap only if the condition is satisfied.
- kprobes uses the unconditional "trap" (0x7fe00008) and single-stepping
  again on this instruction, resulting in another trap without
  evaluating the condition is obviously incorrect.
Signed-off-by: default avatarAnanth N Mavinakayanahalli <ananth@in.ibm.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 054d8ff3
...@@ -90,14 +90,14 @@ void __kprobes arch_remove_kprobe(struct kprobe *p) ...@@ -90,14 +90,14 @@ void __kprobes arch_remove_kprobe(struct kprobe *p)
static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs) static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
{ {
kprobe_opcode_t insn = *p->ainsn.insn;
regs->msr |= MSR_SE; regs->msr |= MSR_SE;
/* single step inline if it is a trap variant */ /*
if (is_trap(insn)) * On powerpc we should single step on the original
regs->nip = (unsigned long)p->addr; * instruction even if the probed insn is a trap
else * variant as values in regs could play a part in
* if the trap is taken or not
*/
regs->nip = (unsigned long)p->ainsn.insn; regs->nip = (unsigned long)p->ainsn.insn;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment