Browse Source

uprobes/powerpc: Teach uprobes to ignore gdb breakpoints

Powerpc has many trap variants that could be used by entities like gdb.
Currently, running gdb on a program being traced by uprobes causes an
endless loop since uprobes doesn't understand that the trap was inserted
by some other entity and a SIGTRAP needs to be delivered.

Teach uprobes to ignore breakpoints that do not belong to it.

Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Ananth N Mavinakayanahalli 12 years ago
parent
commit
ab07e807be
1 changed files with 10 additions and 0 deletions
  1. 10 0
      arch/powerpc/kernel/uprobes.c

+ 10 - 0
arch/powerpc/kernel/uprobes.c

@@ -30,6 +30,16 @@
 
 #define UPROBE_TRAP_NR	UINT_MAX
 
+/**
+ * is_trap_insn - check if the instruction is a trap variant
+ * @insn: instruction to be checked.
+ * Returns true if @insn is a trap variant.
+ */
+bool is_trap_insn(uprobe_opcode_t *insn)
+{
+	return (is_trap(*insn));
+}
+
 /**
  * arch_uprobe_analyze_insn
  * @mm: the probed address space.