]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
sh: kprobes: Fix up race against probe point removal.
authorPaul Mundt <lethal@linux-sh.org>
Mon, 8 Sep 2008 09:15:55 +0000 (18:15 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Mon, 8 Sep 2008 09:15:55 +0000 (18:15 +0900)
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>
arch/sh/kernel/kprobes.c

index f0e1c78d0bff566a8047657a8e87d402163d7383..a478ba78e75289651414f7f4a72d19bdb571c537 100644 (file)
@@ -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;
        }