All of lore.kernel.org
 help / color / mirror / Atom feed
From: qianli zhao <zhaoqianligood@gmail.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Oleg Nesterov <oleg@redhat.com>,
	christian@brauner.io, axboe@kernel.dk,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Collingbourne <pcc@google.com>,
	linux-kernel@vger.kernel.org, Qianli Zhao <zhaoqianli@xiaomi.com>
Subject: Re: [PATCH] exit: trigger panic when init process is set to SIGNAL_GROUP_EXIT
Date: Thu, 11 Mar 2021 12:40:49 +0800	[thread overview]
Message-ID: <CAPx_LQF90joRVLCjR9M44uZ0829Ktw3GAFStdOWEBANGLfDvdQ@mail.gmail.com> (raw)
In-Reply-To: <m1lfavufep.fsf@fess.ebiederm.org>

Hi, Eric
Thank you for your suggestion

> At the start of your changelog and your patch subject you describe what
> you are doing but not why.  For the next revision of the patch please
> lead with the why it makes what you are trying to do much easier to
> understand.

got it.

>
> It does not work to use SIGNAL_UNKILLABLE for this.  Normally init
> has SIGNAL_UNKILLABLE set.  The only case that clears SIGNAL_UNKILLABLE
> is force_sig_info_to_task.  If the init process exits with exit(2)
> SIGNAL_UNKILLABLE will already be set.  Which means testing
> SIGNAL_UNKILLABLE as your patch does will prevent the panic.
>

Ok,using SIGNAL_UNKILLABLE is incorrect.

> Further simply calling panic is sufficient to guarantee that the other
> threads don't exit, and that whichever thread calls panic first
> will be the reporting thread.  The rest of the threads will be caught
> in panic_smp_self_stop(), if they happen to be running on other cpus.
>
> So I would make the whole thing just be:
>
>         /* If global init has exited,
>          * panic immediately to get a useable coredump.
>          */
>         if (unlikely(is_global_init(tsk) &&
>             (thread_group_empty(tsk) ||
>             (tsk->signal->flags & SIGNAL_GROUP_EXIT)))) {
>                 panic("Attempted to kill init!  exitcode=0x%08x\n",
>                         tsk->signal->group_exit_code ?: (int)code);
>         }
>
> The thread_group_empty test is needed to handle single threaded
> inits.
>
> Do you think you can respin your patch as something like that?
>

Ok.it's a very good change,other CPUs calls to panic() will be caught
and execute panic_smp_self_stop(),
there is no need to deal with this situation separately when other CPUs exit().

      parent reply	other threads:[~2021-03-11  4:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09 13:31 [PATCH] exit: trigger panic when init process is set to SIGNAL_GROUP_EXIT Qianli Zhao
2021-03-09 18:26 ` Oleg Nesterov
2021-03-10  3:59   ` qianli zhao
2021-03-10 16:44     ` Eric W. Biederman
2021-03-10 17:32       ` Oleg Nesterov
2021-03-10 19:07         ` Eric W. Biederman
2021-03-10 22:13         ` Eric W. Biederman
2021-03-11  4:40       ` qianli zhao [this message]

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=CAPx_LQF90joRVLCjR9M44uZ0829Ktw3GAFStdOWEBANGLfDvdQ@mail.gmail.com \
    --to=zhaoqianligood@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=christian@brauner.io \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=pcc@google.com \
    --cc=tglx@linutronix.de \
    --cc=zhaoqianli@xiaomi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.