aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/kprobes.c
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2008-06-26 02:57:58 -0400
committerKumar Gala <galak@kernel.crashing.org>2008-06-26 04:35:33 -0400
commitb76e59d1fb086c2fdac5d243e09786d6581f2026 (patch)
tree94348c544cc2c7b26ab0c5aa75b93c89e959a17e /arch/powerpc/kernel/kprobes.c
parentd14b3dd6190af7ce4f88be68f8df828af6d44584 (diff)
powerpc/kprobes: Some minor fixes
* Mark __flush_icache_range as a function that can't be probed since its used by the kprobe code. * Fix an issue with single stepping and async exceptions. We need to ensure that we dont get an async exception (external, decrementer, etc) while we are attempting to single step the probe point. Added a check to ensure we only handle a single step if its really intended for the instruction in question. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/kprobes.c')
-rw-r--r--arch/powerpc/kernel/kprobes.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 23545a2f51f3..74693d91731f 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -95,6 +95,11 @@ void __kprobes arch_remove_kprobe(struct kprobe *p)
95 95
96static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs) 96static void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
97{ 97{
98 /* We turn off async exceptions to ensure that the single step will
99 * be for the instruction we have the kprobe on, if we dont its
100 * possible we'd get the single step reported for an exception handler
101 * like Decrementer or External Interrupt */
102 regs->msr &= ~MSR_EE;
98 regs->msr |= MSR_SE; 103 regs->msr |= MSR_SE;
99 104
100 /* 105 /*
@@ -376,6 +381,10 @@ static int __kprobes post_kprobe_handler(struct pt_regs *regs)
376 if (!cur) 381 if (!cur)
377 return 0; 382 return 0;
378 383
384 /* make sure we got here for instruction we have a kprobe on */
385 if (((unsigned long)cur->ainsn.insn + 4) != regs->nip)
386 return 0;
387
379 if ((kcb->kprobe_status != KPROBE_REENTER) && cur->post_handler) { 388 if ((kcb->kprobe_status != KPROBE_REENTER) && cur->post_handler) {
380 kcb->kprobe_status = KPROBE_HIT_SSDONE; 389 kcb->kprobe_status = KPROBE_HIT_SSDONE;
381 cur->post_handler(cur, regs, 0); 390 cur->post_handler(cur, regs, 0);