Re: [PATCH v3] kernel/exit: do panic earlier to get coredump if global init task exit

From: Christian Brauner
Date: Thu Dec 19 2019 - 05:42:39 EST


On Thu, Dec 19, 2019 at 02:29:53PM +0800, qiwuchen55@xxxxxxxxx wrote:
> From: chenqiwu <chenqiwu@xxxxxxxxxx>
>
> When global init task get a chance to be killed, panic will happen in
> later calling steps by do_exit()->exit_notify()->forget_original_parent()
> ->find_child_reaper() if all init threads have exited.
>
> However, it's hard to extract the coredump of init task from a kernel
> crashdump, since exit_mm() has released its mm before panic. In order
> to get the backtrace of init task in userspace, it's better to do panic
> earlier at the beginning of exitting route.
>
> It's worth noting that we must take case of a multi-threaded init exitting
> issue. We need the test for is_global_init() && group_dead to ensure that
> it is all threads exiting and not just the current thread.
>
> Signed-off-by: chenqiwu <chenqiwu@xxxxxxxxxx>

Acked-by: Christian Brauner <christian.brauner@xxxxxxxxxx>