lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120124162016.08a37b2f.akpm@linux-foundation.org>
Date:	Tue, 24 Jan 2012 16:20:16 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Denys Vlasenko <vda.linux@...glemail.com>
Cc:	linux-kernel@...r.kernel.org, Oleg Nesterov <oleg@...hat.com>
Subject: Re: [PATCH v2] If init dies, log a signal which killed it, if any.

On Fri, 20 Jan 2012 23:17:16 +0100
Denys Vlasenko <vda.linux@...glemail.com> 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.
> 
>
> ...
>
> --- 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);
> +		}

It's a bit user-hostile to print a hex number in such a context without
the leading 0x.  The %08 does provide a hint - users are unlikely to
interpret 00000011 as 11.  But still, I think...

--- a/kernel/exit.c~kernel-exitc-if-init-dies-log-a-signal-which-killed-it-if-any-fix
+++ a/kernel/exit.c
@@ -711,7 +711,7 @@ static struct task_struct *find_new_reap
 	if (unlikely(pid_ns->child_reaper == father)) {
 		write_unlock_irq(&tasklist_lock);
 		if (unlikely(pid_ns == &init_pid_ns)) {
-			panic("Attempted to kill init! exitcode=%08x\n",
+			panic("Attempted to kill init! exitcode=0x%08x\n",
 				father->signal->group_exit_code ?:
 					father->exit_code);
 		}
_

Or maybe we should use %d.  Does anyone use hex for exit codes?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ