public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: qianli zhao <zhaoqianligood@gmail.com>
Cc: christian@brauner.io, axboe@kernel.dk,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Collingbourne <pcc@google.com>,
	linux-kernel@vger.kernel.org, Qianli Zhao <zhaoqianli@xiaomi.com>
Subject: Re: [PATCH V3] exit: trigger panic when global init has exited
Date: Mon, 22 Mar 2021 17:37:05 +0100	[thread overview]
Message-ID: <20210322163705.GD20390@redhat.com> (raw)
In-Reply-To: <CAPx_LQGLYx8gKJSkCx9hTyPPbCbU=GJL31TPb3s6zxro522U0Q@mail.gmail.com>

Hi,

It seems that we don't understand each other.

If we move atomic_dec_and_test(signal->live) and do

	if (group_dead && is_global_init)
		panic(...);


before setting PF_EXITING like your patch does, then zap_pid_ns_processes()
simply won't be called.

Because:

On 03/21, qianli zhao wrote:
>
> Hi,Oleg
>
> > How? Perhaps I missed something again, but I don't think this is possible.
>
> > zap_pid_ns_processes() simply won't be called, find_child_reaper() will
> > see the !PF_EXITING thread which calls panic().
>
> > So I think this should be documented somehow, at least in the changelog.
>
> This problem occurs when both two init threads enter the do_exit,
> One of the init thread is syscall sys_exit_group,and set SIGNAL_GROUP_EXIT
> The other init thread perform ret_to_user()->get_signal() and found
> SIGNAL_GROUP_EXIT is set,then do_group_exit()->do_exit(),since there
> are no alive init threads it finally goes to
> zap_pid_ns_processes()

No, there is at least one alive init thread. If they all have exited, we have
the thread which calls panic() above.

> and BUG().

so we don't need the SIGNAL_GROUP_EXIT check to avoid this BUG().

What have I missed?

Oleg.


  reply	other threads:[~2021-03-22 16:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17 12:51 [PATCH V3] exit: trigger panic when global init has exited Qianli Zhao
2021-03-17 14:38 ` Oleg Nesterov
2021-03-18  2:47   ` qianli zhao
2021-03-18 18:04     ` Oleg Nesterov
2021-03-18 19:08       ` Eric W. Biederman
2021-03-19  6:33         ` qianli zhao
2021-03-19 16:34           ` Oleg Nesterov
2021-03-19 16:26         ` Oleg Nesterov
2021-03-21 16:00         ` qianli zhao
2021-03-22 17:07           ` Oleg Nesterov
2021-03-22 17:09             ` Oleg Nesterov
2021-03-19  5:08       ` qianli zhao
2021-03-19 16:32         ` Oleg Nesterov
2021-03-21 13:04           ` qianli zhao
2021-03-22 16:37             ` Oleg Nesterov [this message]
2021-03-23  3:14               ` qianli zhao
2021-03-23  9:00                 ` Oleg Nesterov
2021-03-23 11:23                   ` qianli zhao
2021-03-24 18:12                     ` Oleg Nesterov
2021-03-25  3:00                       ` qianli zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210322163705.GD20390@redhat.com \
    --to=oleg@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=christian@brauner.io \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pcc@google.com \
    --cc=tglx@linutronix.de \
    --cc=zhaoqianli@xiaomi.com \
    --cc=zhaoqianligood@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox