Skip to content

Commit 6bf755d

Browse files
osandovRussell King
authored andcommitted
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>
1 parent c5cc87f commit 6bf755d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/arm/kernel/kgdb.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,16 @@ static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned int instr)
160160
static struct undef_hook kgdb_brkpt_hook = {
161161
.instr_mask = 0xffffffff,
162162
.instr_val = KGDB_BREAKINST,
163+
.cpsr_mask = MODE_MASK,
164+
.cpsr_val = SVC_MODE,
163165
.fn = kgdb_brk_fn
164166
};
165167

166168
static struct undef_hook kgdb_compiled_brkpt_hook = {
167169
.instr_mask = 0xffffffff,
168170
.instr_val = KGDB_COMPILED_BREAK,
171+
.cpsr_mask = MODE_MASK,
172+
.cpsr_val = SVC_MODE,
169173
.fn = kgdb_compiled_brk_fn
170174
};
171175

0 commit comments

Comments
 (0)