]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ARM: 8124/1: don't enter kgdb when userspace executes a kgdb break instruction
authorOmar Sandoval <osandov@osandov.com>
Fri, 1 Aug 2014 17:14:06 +0000 (18:14 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Sat, 2 Aug 2014 14:20:30 +0000 (15:20 +0100)
The kgdb breakpoint hooks (kgdb_brk_fn and kgdb_compiled_brk_fn)
should only be entered when a kgdb break instruction is executed
from the kernel. Otherwise, if kgdb is enabled, a userspace program
can cause the kernel to drop into the debugger by executing either
KGDB_BREAKINST or KGDB_COMPILED_BREAK.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Omar Sandoval <osandov@osandov.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/kernel/kgdb.c

index 778c2f7024ff57304227ce67665e749f39b05fc7..a74b53c1b7dfc3566e51957b6422da290121ff93 100644 (file)
@@ -160,12 +160,16 @@ static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned int instr)
 static struct undef_hook kgdb_brkpt_hook = {
        .instr_mask             = 0xffffffff,
        .instr_val              = KGDB_BREAKINST,
+       .cpsr_mask              = MODE_MASK,
+       .cpsr_val               = SVC_MODE,
        .fn                     = kgdb_brk_fn
 };
 
 static struct undef_hook kgdb_compiled_brkpt_hook = {
        .instr_mask             = 0xffffffff,
        .instr_val              = KGDB_COMPILED_BREAK,
+       .cpsr_mask              = MODE_MASK,
+       .cpsr_val               = SVC_MODE,
        .fn                     = kgdb_compiled_brk_fn
 };