Commit 6bf755db authored by Omar Sandoval's avatar Omar Sandoval Committed by Russell King

ARM: 8124/1: don't enter kgdb when userspace executes a kgdb break instruction

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: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarOmar Sandoval <osandov@osandov.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent c5cc87fa
...@@ -160,12 +160,16 @@ static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned int instr) ...@@ -160,12 +160,16 @@ static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned int instr)
static struct undef_hook kgdb_brkpt_hook = { static struct undef_hook kgdb_brkpt_hook = {
.instr_mask = 0xffffffff, .instr_mask = 0xffffffff,
.instr_val = KGDB_BREAKINST, .instr_val = KGDB_BREAKINST,
.cpsr_mask = MODE_MASK,
.cpsr_val = SVC_MODE,
.fn = kgdb_brk_fn .fn = kgdb_brk_fn
}; };
static struct undef_hook kgdb_compiled_brkpt_hook = { static struct undef_hook kgdb_compiled_brkpt_hook = {
.instr_mask = 0xffffffff, .instr_mask = 0xffffffff,
.instr_val = KGDB_COMPILED_BREAK, .instr_val = KGDB_COMPILED_BREAK,
.cpsr_mask = MODE_MASK,
.cpsr_val = SVC_MODE,
.fn = kgdb_compiled_brk_fn .fn = kgdb_compiled_brk_fn
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment