summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2008-09-08 09:15:55 (GMT)
committerPaul Mundt <lethal@linux-sh.org>2008-09-08 09:15:55 (GMT)
commit734db3770de03fbe9ae4e78519a7d1678189788c (patch)
tree592de33e308a1e318281d2af0eec1ce686c5557f
parent247bc6d2ae3e2de08529977952c7d085f9d562d4 (diff)
downloadlinux-734db3770de03fbe9ae4e78519a7d1678189788c.tar.xz
sh: kprobes: Fix up race against probe point removal.
Handle a corner case where another CPU or debugger removes the probe point from underneath us. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/kernel/kprobes.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/sh/kernel/kprobes.c b/arch/sh/kernel/kprobes.c
index f0e1c78..a478ba7 100644
--- a/arch/sh/kernel/kprobes.c
+++ b/arch/sh/kernel/kprobes.c
@@ -252,6 +252,17 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
p = get_kprobe(addr);
if (!p) {
/* Not one of ours: let kernel handle it */
+ if (*(kprobe_opcode_t *)addr != BREAKPOINT_INSTRUCTION) {
+ /*
+ * The breakpoint instruction was removed right
+ * after we hit it. Another cpu has removed
+ * either a probepoint or a debugger breakpoint
+ * at this address. In either case, no further
+ * handling of this interrupt is appropriate.
+ */
+ ret = 1;
+ }
+
goto no_kprobe;
}