Hi,Oleg > But then I don't understand the SIGNAL_GROUP_EXIT check added by your > patch. Do we really need it if we want to avoid zap_pid_ns_processes() > when the global init exits?
I think check SIGNAL_GROUP_EXIT is necessary,or panic() will happen after all init sub-threads do_exit(),so the following two situations will happen: 1.According to the timing in the changelog, zap_pid_ns_processes()->BUG() maybe happened. 2.The key variables of each init sub-threads will be in the exit state(such task->mm=NULL,task->flags=PF_EXITING,task->nsproxy=NULL),resulting in the failure to parse coredump from fulldump. So i think check SIGNAL_GROUP_EXIT is a simple and effective way to prevent these > Does this connect to SIGNAL_GROUP_EXIT check? Do you mean that you want > to panic earlier, before other init's sub-threads exit? Yes, my patch just want panic earlier before other init's sub-threads exit Oleg Nesterov <o...@redhat.com> 于2021年3月19日周五 上午2:05写道: > > On 03/18, qianli zhao wrote: > > > > Hi,Oleg > > > > Thank you for your reply. > > > > >> When init sub-threads running on different CPUs exit at the same time, > > >> zap_pid_ns_processe()->BUG() may be happened. > > > > > and why do you think your patch can't prevent this? > > > > > Sorry, I must have missed something. But it seems to me that you are > > > trying > > > to fix the wrong problem. Yes, zap_pid_ns_processes() must not be called > > > in > > > the root namespace, and this has nothing to do with CONFIG_PID_NS. > > > > Yes, i try to fix this exception by test SIGNAL_GROUP_EXIT and call > > panic before setting PF_EXITING to prevent zap_pid_ns_processes() > > being called when init do_exit(). > > Ah, I didn't notice your patch does atomic_dec_and_test(signal->live) > before exit_signals() which sets PF_EXITING. Thanks for correcting me. > > So yes, I was wrong, your patch can prevent this. Although I'd like to > recheck if every do-something-if-group-dead action is correct in the > case we have a non-PF_EXITING thread... > > But then I don't understand the SIGNAL_GROUP_EXIT check added by your > patch. Do we really need it if we want to avoid zap_pid_ns_processes() > when the global init exits? > > > In addition, the patch also protects the init process state to > > successfully get usable init coredump. > > Could you spell please? > > Does this connect to SIGNAL_GROUP_EXIT check? Do you mean that you want > to panic earlier, before other init's sub-threads exit? > > Thanks, > > Oleg. >