[PATCH] kprobes: fix single-stepping when probing a trap variant
Ananth N Mavinakayanahalli
ananth at in.ibm.com
Thu Mar 16 21:01:24 EST 2006
Hi,
We currently single-step inline if the instruction on which a kprobe is
set 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 instruction (0x7fe00008) and
single-stepping again on this instruction, resulting in another trap
without evaluating the condition is obviously incorrect.
Signed-off-by: Ananth N Mavinakayanahalli <ananth at in.ibm.com>
---
arch/powerpc/kernel/kprobes.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
Index: linux-2.6.16-rc6/arch/powerpc/kernel/kprobes.c
===================================================================
--- linux-2.6.16-rc6.orig/arch/powerpc/kernel/kprobes.c
+++ linux-2.6.16-rc6/arch/powerpc/kernel/kprobes.c
@@ -92,11 +92,13 @@ static inline void prepare_singlestep(st
regs->msr |= MSR_SE;
- /* single step inline if it is a trap variant */
- if (is_trap(insn))
- regs->nip = (unsigned long)p->addr;
- else
- regs->nip = (unsigned long)p->ainsn.insn;
+ /*
+ * On powerpc we should single step on the original
+ * instruction even if the probed insn is a trap
+ * variant as values in regs could play a part in
+ * if the trap is taken or not
+ */
+ regs->nip = (unsigned long)p->ainsn.insn;
}
static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb)
More information about the Linuxppc64-dev
mailing list