All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: Jason Wessel <jason.wessel@windriver.com>,
	Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] don't prefer unsuited consoles on registration
Date: Wed, 30 Jan 2008 01:11:34 +0100	[thread overview]
Message-ID: <479FC0B6.8000607@web.de> (raw)

KGDB triggers a (probably so far theoretical) issue of the automatic
init console election: If some console happens to be registered first
which does not provide a tty binding (!console->device), it prevents
that more suited consoles which are registered later on can enter the
candidate pool for console_device(). This is observable with KGDB's
console which may already be registered (and exploited!) during early
debugger connections, that is before any regular console registration.

This patch fixes the issue by postponing the final, automated
preferred_console selection until someone with a non-NULL device
handler comes around.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>

---
 kernel/printk.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Index: b/kernel/printk.c
===================================================================
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1126,8 +1126,11 @@ void register_console(struct console *co
 			console->index = 0;
 		if (console->setup == NULL ||
 		    console->setup(console, NULL) == 0) {
-			console->flags |= CON_ENABLED | CON_CONSDEV;
-			preferred_console = 0;
+			console->flags |= CON_ENABLED;
+			if (console->device) {
+				console->flags |= CON_CONSDEV;
+				preferred_console = 0;
+			}
 		}
 	}
 

                 reply	other threads:[~2008-01-30  0:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=479FC0B6.8000607@web.de \
    --to=jan.kiszka@web.de \
    --cc=akpm@linux-foundation.org \
    --cc=jason.wessel@windriver.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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.