lkml.org 
[lkml]   [2019]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] kernel/exit: do panic earlier to get coredump if global init task exit
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>

\
 
 \ /
  Last update: 2019-12-20 20:39    [W:0.039 / U:2.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site