From: Oleg Nesterov <oleg@redhat.com>
To: Denys Vlasenko <vda.linux@googlemail.com>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2] If init dies, log a signal which killed it, if any.
Date: Mon, 23 Jan 2012 16:03:09 +0100 [thread overview]
Message-ID: <20120123150309.GA8153@redhat.com> (raw)
In-Reply-To: <1327097836-8485-1-git-send-email-vda.linux@googlemail.com>
On 01/20, Denys Vlasenko wrote:
>
> I just received another user's pleas for help when their
> init mysteriously died. I again explained that they need to check
> whether it died because of bad instruction, a segv, or something else.
> Which was an annoying detour into writing a trivial C program
> to spawn his init and print its exit code:
>
> http://lists.busybox.net/pipermail/busybox/2012-January/077172.html
>
> I hear you saying "just test it under /bin/sh". Well, the crashing init
> _was_ /bin/sh.
>
> Which prompted me to make kernel do this first step automatically.
> We can print exit code, which makes it possible to see that
> death was from e.g. SIGILL without writing test programs.
>
> The code is fairly self-explanatory. Compile-tested.
>
> Changes in v.2: don't try to decode signal names, just print
> exit status in hex.
Looks reasonable to me.
Probably you should re-send the patch to Andrew, I do not know who
else can pick it.
Acked-by: Oleg Nesterov <oleg@redhat.com>
> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
> ---
> kernel/exit.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/exit.c b/kernel/exit.c
> index 294b170..0c540a5 100644
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -710,8 +710,11 @@ static struct task_struct *find_new_reaper(struct task_struct *father)
>
> if (unlikely(pid_ns->child_reaper == father)) {
> write_unlock_irq(&tasklist_lock);
> - if (unlikely(pid_ns == &init_pid_ns))
> - panic("Attempted to kill init!");
> + if (unlikely(pid_ns == &init_pid_ns)) {
> + panic("Attempted to kill init! exitcode=%08x\n",
> + father->signal->group_exit_code ?:
> + father->exit_code);
> + }
>
> zap_pid_ns_processes(pid_ns);
> write_lock_irq(&tasklist_lock);
> --
> 1.7.7.5
>
next prev parent reply other threads:[~2012-01-23 15:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-20 22:17 [PATCH v2] If init dies, log a signal which killed it, if any Denys Vlasenko
2012-01-23 15:03 ` Oleg Nesterov [this message]
2012-01-25 0:20 ` Andrew Morton
2012-01-25 9:08 ` Denys Vlasenko
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=20120123150309.GA8153@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vda.linux@googlemail.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.