ARM: kgdb: ignore breakpoint instructions from user mode
authorTodd Poynor <toddpoynor@google.com>
Wed, 3 Jul 2013 22:48:04 +0000 (15:48 -0700)
committerColin Cross <ccross@android.com>
Thu, 19 Sep 2013 18:50:04 +0000 (13:50 -0500)
Avoid conflicts with user mode usage of the same instructions, as with
Clang -ftrapv.

Change-Id: I12d1c6d8f94376bfd2503cb0be843d7e478fb6ea
Signed-off-by: Todd Poynor <toddpoynor@google.com>
arch/arm/kernel/kgdb.c

index 778c2f7024ff57304227ce67665e749f39b05fc7..b321c8fbb87dc8d68b60712c6f74c5d306ca8777 100644 (file)
@@ -144,6 +144,8 @@ int kgdb_arch_handle_exception(int exception_vector, int signo,
 
 static int kgdb_brk_fn(struct pt_regs *regs, unsigned int instr)
 {
+       if (user_mode(regs))
+               return -1;
        kgdb_handle_exception(1, SIGTRAP, 0, regs);
 
        return 0;
@@ -151,6 +153,8 @@ static int kgdb_brk_fn(struct pt_regs *regs, unsigned int instr)
 
 static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned int instr)
 {
+       if (user_mode(regs))
+               return -1;
        compiled_break = 1;
        kgdb_handle_exception(1, SIGTRAP, 0, regs);