aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/kgdb.c
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@osandov.com>2014-08-01 13:14:06 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-08-02 10:20:30 -0400
commit6bf755db4d5e7ccea61fb17727a183b9bd8945b1 (patch)
tree74ca99a04770e5ff8598bbf63e30a1d9025dc338 /arch/arm/kernel/kgdb.c
parentc5cc87fa8ddf971682fc5dd112e2dfacb11f30cd (diff)
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: 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>
Diffstat (limited to 'arch/arm/kernel/kgdb.c')
-rw-r--r--arch/arm/kernel/kgdb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c
index 778c2f7024ff..a74b53c1b7df 100644
--- a/arch/arm/kernel/kgdb.c
+++ b/arch/arm/kernel/kgdb.c
@@ -160,12 +160,16 @@ static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned int instr)
160static struct undef_hook kgdb_brkpt_hook = { 160static struct undef_hook kgdb_brkpt_hook = {
161 .instr_mask = 0xffffffff, 161 .instr_mask = 0xffffffff,
162 .instr_val = KGDB_BREAKINST, 162 .instr_val = KGDB_BREAKINST,
163 .cpsr_mask = MODE_MASK,
164 .cpsr_val = SVC_MODE,
163 .fn = kgdb_brk_fn 165 .fn = kgdb_brk_fn
164}; 166};
165 167
166static struct undef_hook kgdb_compiled_brkpt_hook = { 168static struct undef_hook kgdb_compiled_brkpt_hook = {
167 .instr_mask = 0xffffffff, 169 .instr_mask = 0xffffffff,
168 .instr_val = KGDB_COMPILED_BREAK, 170 .instr_val = KGDB_COMPILED_BREAK,
171 .cpsr_mask = MODE_MASK,
172 .cpsr_val = SVC_MODE,
169 .fn = kgdb_compiled_brk_fn 173 .fn = kgdb_compiled_brk_fn
170}; 174};
171 175