[PATCH] arm64: debug: don't re-enable debug exceptions on return from el1_dbg

Subsystems: arm64 port (aarch64 architecture), the rest

STALE4329d

2 messages, 2 authors, 2014-09-23 · open the first message on its own page

[PATCH] arm64: debug: don't re-enable debug exceptions on return from el1_dbg

From: Will Deacon <hidden>
Date: 2014-09-22 10:19:04

When returning from a debug exception taken from EL1, we unmask debug
exceptions after handling the exception. This is crucial for debug
exceptions taken from EL0, so that any kernel work on the ret_to_user
path can be debugged by kgdb.

However, when returning back to EL1 the only thing left to do is to
restore the original register state before the exception return. If
single-step has been enabled by the debug exception handler, we will
get stuck in an infinite debug exception loop, since we will take the
step exception as soon as we unmask debug exceptions.

This patch avoids unmasking debug exceptions on the debug exception
return path when the exception was taken from EL1.

Cc: <redacted>
Reported-by: David Long <redacted>
Reported-by: AKASHI Takahiro <redacted>
Signed-off-by: Will Deacon <redacted>
---
 arch/arm64/kernel/entry.S | 1 -
 1 file changed, 1 deletion(-)
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index f0b5e5120a87..726b910fe6ec 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -324,7 +324,6 @@ el1_dbg:
 	mrs	x0, far_el1
 	mov	x2, sp				// struct pt_regs
 	bl	do_debug_exception
-	enable_dbg
 	kernel_exit 1
 el1_inv:
 	// TODO: add support for undefined instructions in kernel mode
-- 
2.1.0

[PATCH] arm64: debug: don't re-enable debug exceptions on return from el1_dbg

From: catalin.marinas@arm.com (Catalin Marinas)
Date: 2014-09-23 14:40:02

On Mon, Sep 22, 2014 at 11:19:04AM +0100, Will Deacon wrote:
When returning from a debug exception taken from EL1, we unmask debug
exceptions after handling the exception. This is crucial for debug
exceptions taken from EL0, so that any kernel work on the ret_to_user
path can be debugged by kgdb.

However, when returning back to EL1 the only thing left to do is to
restore the original register state before the exception return. If
single-step has been enabled by the debug exception handler, we will
get stuck in an infinite debug exception loop, since we will take the
step exception as soon as we unmask debug exceptions.

This patch avoids unmasking debug exceptions on the debug exception
return path when the exception was taken from EL1.

Cc: <redacted>
Does it work better if I add:

Fixes: 2a2830703a23 (arm64: debug: avoid accessing mdscr_el1 on fault paths where possible)
Cc: <redacted> #3.16+

-- 
Catalin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help