Messages in this thread | | | Date | Fri, 20 Dec 2019 20:52:59 +0100 | Subject | Re: [PATCH v3] kernel/exit: do panic earlier to get coredump if global init task exit | From | Christian Brauner <> |
| |
On December 20, 2019 8:38:00 PM GMT+01:00, Oleg Nesterov <oleg@redhat.com> wrote: >On 12/19, qiwuchen55@gmail.com wrote: >> >> @@ -517,10 +517,6 @@ static struct task_struct >*find_child_reaper(struct task_struct *father, >> } >> >> write_unlock_irq(&tasklist_lock); >> - if (unlikely(pid_ns == &init_pid_ns)) { >> - panic("Attempted to kill init! exitcode=0x%08x\n", >> - father->signal->group_exit_code ?: father->exit_code); >> - } >> >> list_for_each_entry_safe(p, n, dead, ptrace_entry) { >> list_del_init(&p->ptrace_entry); >> @@ -766,6 +762,15 @@ void __noreturn do_exit(long code) >> acct_update_integrals(tsk); >> group_dead = atomic_dec_and_test(&tsk->signal->live); >> if (group_dead) { >> + /* >> + * If the last thread of global init exit, do panic >> + * immeddiately to get the coredump to find any clue >> + * for init task in userspace. >> + */ >> + if (unlikely(is_global_init(tsk))) >> + panic("Attempted to kill init! exitcode=0x%08x\n", >> + tsk->signal->group_exit_code ?: (int)code); >> + > >Acked-by: Oleg Nesterov <oleg@redhat.com>
Thanks. I'll pick this up unless someone objects.
Christian
| |