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: <87d3ddppo5.fsf@rustcorp.com.au>
Date:	Mon, 31 Oct 2011 18:18:26 +1030
From:	Rusty Russell <rusty@...abs.org>
To:	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>, miche@...gle.com,
	gregkh@...e.de, linux-kernel@...r.kernel.org
Cc:	xen-devel@...ts.xensource.com
Subject: Re: Regression: patch " hvc_console: display printk messages on console." causing infinite loop with 3.2-rc0 + Xen.

On Thu, 27 Oct 2011 01:30:08 -0400, Konrad Rzeszutek Wilk <konrad.wilk@...cle.com> wrote:
Non-text part: multipart/mixed
> Hey Miche.
> 
> The git commit 361162459f62dc0826b82c9690a741a940f457f0:
> 
>     hvc_console: display printk messages on console.
> 
> is causing an infinite loop when booting Linux under Xen, as so:

lguest too.

This is not a concurrency problem: the issue seems to be that calling
register_console() twice on the same struct console is a bad idea.

Simple fix which works here (might be completely wrong):

diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
--- a/drivers/tty/hvc/hvc_console.c
+++ b/drivers/tty/hvc/hvc_console.c
@@ -197,6 +197,8 @@ static int __init hvc_console_setup(stru
 	return 0;
 }
 
+static bool console_registered = false;
+
 static struct console hvc_console = {
 	.name		= "hvc",
 	.write		= hvc_console_print,
@@ -224,6 +226,7 @@ static struct console hvc_console = {
 static int __init hvc_console_init(void)
 {
 	register_console(&hvc_console);
+	console_registered = true;
 	return 0;
 }
 console_initcall(hvc_console_init);
@@ -279,8 +282,10 @@ int hvc_instantiate(uint32_t vtermno, in
 	 * now (setup won't fail at this point).  It's ok to just
 	 * call register again if previously .setup failed.
 	 */
-	if (index == hvc_console.index)
+	if (index == hvc_console.index && !console_registered) {
 		register_console(&hvc_console);
+		console_registered = true;
+	}
 
 	return 0;
 }
@@ -868,7 +873,10 @@ struct hvc_struct *hvc_alloc(uint32_t vt
 
 	list_add_tail(&(hp->next), &hvc_structs);
 	spin_unlock(&hvc_structs_lock);
-	register_console(&hvc_console);
+	if (!console_registered) {
+		register_console(&hvc_console);
+		console_registered = true;
+	}
 
 	return hp;
 }
@@ -880,6 +888,7 @@ int hvc_remove(struct hvc_struct *hp)
 	struct tty_struct *tty;
 
 	unregister_console(&hvc_console);
+	console_registered = false;
 	spin_lock_irqsave(&hp->lock, flags);
 	tty = tty_kref_get(hp->tty);
 
--
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