[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191220193758.GE13464@redhat.com>
Date: Fri, 20 Dec 2019 20:38:00 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: qiwuchen55@...il.com
Cc: christian.brauner@...ntu.com, peterz@...radead.org,
mingo@...nel.org, prsood@...eaurora.org, kernel-team@...roid.com,
linux-kernel@...r.kernel.org, chenqiwu@...omi.com
Subject: Re: [PATCH v3] kernel/exit: do panic earlier to get coredump if
global init task exit
On 12/19, qiwuchen55@...il.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@...hat.com>
Powered by blists - more mailing lists