Re: [PATCH v3 2/2] exit: dump current pt_regs info on global init exit
From: Oleg Nesterov
Date: Sun Sep 22 2024 - 08:55:34 EST
Add lkml.
On 09/22, qiwu.chen wrote:
>
> @@ -847,10 +848,12 @@ void __noreturn do_exit(long code)
> * If the last thread of global init has exited, panic
> * immediately to get a useable coredump.
> */
> - if (unlikely(is_global_init(tsk)))
> + if (unlikely(is_global_init(tsk))) {
> + /* dump the pt_regs of current thread for debugging. */
> + show_regs(task_pt_regs(tsk));
> panic("Attempted to kill init! exitcode=0x%08x\n",
> tsk->signal->group_exit_code ?: (int)code);
Well, this means that show_regs() will be called twice if CONFIG_DEBUG_BUGVERBOSE
at least on x86, see dump_stack() in panic(). See also show_regs_if_on_stack()
in show_trace_log_lvl().
Not good...
Oleg.