From: ebiederm@xmission.com (Eric W. Biederman)
To: Oleg Nesterov <oleg@redhat.com>
Cc: qianli zhao <zhaoqianligood@gmail.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: Wed, 10 Mar 2021 13:07:26 -0600 [thread overview]
Message-ID: <m1v99yrfo1.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <20210310173236.GB8973@redhat.com> (Oleg Nesterov's message of "Wed, 10 Mar 2021 18:32:37 +0100")
Oleg Nesterov <oleg@redhat.com> writes:
> On 03/10, Eric W. Biederman wrote:
>>
>> /* 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.
>
> But we can't rely on thread_group_empty(). Just suppose that the main
> thread exit first, then the 2nd (last) thread exits too.
My code above is designed so that every thread calls panic.
Only the first thread into panic actually writes the panic (That is in
panic itself).
By testing for thread_group_empty() || SIGNAL_GROUP_EXIT
I am just trying to allow threads of init to exit.
Maybe thread_group_empty isn't the exact test we need to allow those.
Eric
next prev parent reply other threads:[~2021-03-10 19:08 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 [this message]
2021-03-10 22:13 ` Eric W. Biederman
2021-03-11 4:40 ` 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=m1v99yrfo1.fsf@fess.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=axboe@kernel.dk \
--cc=christian@brauner.io \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--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