arm64: debug: don't re-enable debug exceptions on return from el1_dbg
PATCH 1/1 arm64: debug: don't re-enable debug exceptions on return from el1_dbg
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.
--- arch/arm64/kernel/entry.S | 1 - 1 file changed, 1 deletion(-)
arch/arm64/kernel/entry.S +0 -1
@@ -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
Signature · 1 line
2.1.0
Catalin Marinas
maintainerPATCH 1/1 arm64: debug: don't re-enable debug exceptions on return from el1_dbg
Quoted 11 lines · Will Deacon
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_userpath 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.
Quoted 4 lines
This patch avoids unmasking debug exceptions on the debug exception return path when the exception was taken from EL1.
Cc <[email protected]>
Does it work better if I add:
Signature · 1 line
Catalin