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] [day] [month] [year] [list]
Date:	Mon, 9 Oct 2006 10:26:34 +0200
From:	Ingo Molnar <mingo@...e.hu>
To:	Tilman Schmidt <tilman@...p.cc>
Cc:	LKML <linux-kernel@...r.kernel.org>, Andrew Morton <akpm@...l.org>
Subject: [patch] lockdep: fix printk recursion logic


* Tilman Schmidt <tilman@...p.cc> wrote:

> Problem description:
> > While X is running, output from printk() appears in syslog (eg.
> > /var/log/messages) only after a key is pressed on the system keyboard,
> > even though it is visible with dmesg immediately.
> (from lkml message <450BF1CC.2070309@...p.cc> - see that message
> for further details)
> 
> The problem did not exist in 2.6.17, so I think it qualifies as a 
> regression.
> 
> The following naive patch fixes the problem for me, without any 
> apparent ill effects (ie. the menace of lockup never manifested 
> itself):
> 
> --- a/kernel/printk.c   2006-10-07 00:51:09.000000000 +0200
> +++ b/kernel/printk.c   2006-10-07 00:51:41.000000000 +0200
> @@ -826,8 +826,7 @@ void release_console_sem(void)
>                  * from within the scheduler code, then do not lock
>                  * up due to self-recursion:
>                  */
> -               if (!lockdep_internal())
> -                       wake_up_interruptible(&log_wait);
> +               wake_up_interruptible(&log_wait);

the reason is that i initially only had the chunk above to protect 
against lockdep recursion within vprintk() - it grew the 'outer' 
lockdep_off()/on() protection only later on. But that lockdep_off() made 
the release_console_sem() within vprintk() always happen under the 
lockdep_internal() condition, causing your bug.

so the right solution is your patch: to remove the inner protection 
against recursion here - the outer one is enough.

Andrew, could we use the patch below - it also removes a now stale 
comment. Also for -stable review i think.

	Ingo

---------------->
Subject: lockdep: fix printk recursion logic
From: Ingo Molnar <mingo@...e.hu>

bug reported and fixed by Tilman Schmidt <tilman@...p.cc>: if
lockdep is enabled then log messages make it to /var/log/messages
belatedly. The reason is a missed wakeup of klogd.

initially there was only a lockdep_internal() protection against
lockdep recursion within vprintk() - it grew the 'outer'
lockdep_off()/on() protection only later on. But that lockdep_off() made
the release_console_sem() within vprintk() always happen under the
lockdep_internal() condition, causing the bug.

the right solution to remove the inner protection against
recursion here - the outer one is enough.

Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
 kernel/printk.c |   11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

Index: linux/kernel/printk.c
===================================================================
--- linux.orig/kernel/printk.c
+++ linux/kernel/printk.c
@@ -801,15 +801,8 @@ void release_console_sem(void)
 	console_locked = 0;
 	up(&console_sem);
 	spin_unlock_irqrestore(&logbuf_lock, flags);
-	if (wake_klogd && !oops_in_progress && waitqueue_active(&log_wait)) {
-		/*
-		 * If we printk from within the lock dependency code,
-		 * from within the scheduler code, then do not lock
-		 * up due to self-recursion:
-		 */
-		if (!lockdep_internal())
-			wake_up_interruptible(&log_wait);
-	}
+	if (wake_klogd && !oops_in_progress && waitqueue_active(&log_wait))
+		wake_up_interruptible(&log_wait);
 }
 EXPORT_SYMBOL(release_console_sem);
 
-
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