[PATCH] sh/kprobes: Fix illslot handler not to unregister but disarmkprobe

From: Masami Hiramatsu
Date: Wed Jun 19 2013 - 07:45:37 EST


Fix illegal slot exception handler not to unregister the kprobe
but just to disarm it. Since the unregister_kprobe must sleep (by
synchronize_sched), it must not be called from any exception/
interrupt handlers. Disarming is safe because it just recovers
original instruction code.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx>
Cc: Paul Mundt <lethal@xxxxxxxxxxxx>
Cc: Sasha Levin <sasha.levin@xxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: "Paul E. McKenney" <paulmck@xxxxxxxxxxxxxxxxxx>
---
arch/sh/kernel/kprobes.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/sh/kernel/kprobes.c b/arch/sh/kernel/kprobes.c
index 42b46e6..5ec8182 100644
--- a/arch/sh/kernel/kprobes.c
+++ b/arch/sh/kernel/kprobes.c
@@ -82,7 +82,7 @@ int __kprobes arch_trampoline_kprobe(struct kprobe *p)

/**
* If an illegal slot instruction exception occurs for an address
- * containing a kprobe, remove the probe.
+ * containing a kprobe, disarm the probe.
*
* Returns 0 if the exception was handled successfully, 1 otherwise.
*/
@@ -93,7 +93,7 @@ int __kprobes kprobe_handle_illslot(unsigned long pc)
if (p != NULL) {
printk("Warning: removing kprobe from delay slot: 0x%.8x\n",
(unsigned int)pc + 2);
- unregister_kprobe(p);
+ arch_disarm_kprobe(p);
return 0;
}



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/