[PATCH v4 2/2] arm64: show signal info for global init

qiwu.chen qiwuchen55 at gmail.com
Tue Sep 24 00:43:41 PDT 2024


Currently, it's hard to debug panic issues caused by kill init
on arm64, since there is no debug info from user mode in current
panic msg such as the user_regs and maps info.

This patch shows signal info sent to the global init, which will
be helpful for debugging kill init issue caused by unhandled exception
from user mode.

- changes history:
v3:
https://lore.kernel.org/all/20240922095504.7182-1-qiwu.chen@transsion.com/
https://lore.kernel.org/all/20240922095504.7182-2-qiwu.chen@transsion.com/
v2: https://lore.kernel.org/all/20231110031553.33186-1-qiwu.chen@transsion.com/
v1: https://lore.kernel.org/all/20231110022720.GA3087@rlk/

Signed-off-by: qiwu.chen <qiwu.chen at transsion.com>
---
 arch/arm64/kernel/traps.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 563cbce11126..3150fb84195f 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -247,12 +247,20 @@ static void arm64_show_signal(int signo, const char *str)
 	unsigned long esr = tsk->thread.fault_code;
 	struct pt_regs *regs = task_pt_regs(tsk);
 
+	/*
+	 * The signal sent to the global init needs to be shown,
+	 * which is useful for debugging kill init issue.
+	 */
+	if (unlikely(is_global_init(tsk)))
+		goto dump;
+
 	/* Leave if the signal won't be shown */
 	if (!show_unhandled_signals ||
 	    !unhandled_signal(tsk, signo) ||
 	    !__ratelimit(&rs))
 		return;
 
+dump:
 	pr_info("%s[%d]: unhandled exception: ", tsk->comm, task_pid_nr(tsk));
 	if (esr)
 		pr_cont("%s, ESR 0x%016lx, ", esr_get_class_string(esr), esr);
-- 
2.25.1




More information about the linux-arm-kernel mailing list