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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 22 Oct 2012 12:51:03 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Qing Z <njumical@...il.com>
Cc:	mingo@...nel.org, ben@...adent.org.uk, markivx@...eaurora.org,
	ak@...ux.intel.com, linux-kernel@...r.kernel.org,
	cxie4@...vell.com, binw@...vell.com, wwang27@...vell.com,
	xjian@...vell.com, zhangwm@...vell.com, Qing Zhu <qzhu@...vell.com>
Subject: Re: [PATCH] panic: fix incomplete panic log in panic()

On Mon, 22 Oct 2012 22:54:54 +0800
Qing Z <njumical@...il.com> wrote:

> Hi Andrew,
>           Basically, console_unlock() should be called to make panic
> log printed.  Call console_unlock() in panic have some risks when
> recurse in it(are there other bad cases?). The condition is very rare
> and the two issue cases I list always happen between console_lock()
> and console_unlock(). So I think we need to couple with
> console_lock(), but should avoid the case that panic happen in
> console_unlock().  I think it is a more modest and safe way.  Please
> corect me if there is something wrong. Thanks!
> 
> bool Is_in_console_unlock;
> void console_unlock(void)
> {
>        ...
> +      Is_in_console_unlock = ture;
>         /* flush buffered message fragment immediately to console */
>         console_cont_flush(text, sizeof(text));
> again:
>         for (;;) {
>         ....
>  +       Is_in_console_unlock = false;
> }
> 
> void panic(const char *fmt, ...)
> {
>         ....
> +      /*
> +       * we should unlock console here to make oops log printed, in case
> +       * console is locked before panic in this cpu, or other cpus lock the
> +       * console before be stopped.
> +       */
> +      if( unlikely(console_locked) && !Is_in_console_unlock )
> +           {
> +                  console_unlock();
> +                  console_locked = 0;
> +            }
> 
>         /*
>          * Note smp_send_stop is the usual smp shutdown function, which
>          * unfortunately means it may not be hardened to work in a panic
>          * situation.
>          */
>         smp_send_stop();
> 
>         ....
> }

Well, if something like that will solve the problem then yes, I guess
that is the way to go.  It's not pretty, but it is clear and direct,
and this isn't a pretty problem!

But is this approach sufficient?  What happens in the case of an oops
or a BUG() inside console_lock()?

--
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