Little console problem in 2.5.30
Hi, all:
I would appreciate if someone would explain me if the attached patch does the right thing. The problem is that I do not use the framebuffer, and use a serial console. Whenever a legacy /sbin/init tries to open /dev/tty0, the system oopses dereferencing conswitchp in visual_init().
-- Pete
drivers/char/console.c +1 -1
@@ -652,7 +652,7 @@int vc_allocate (unsigned int currcons)/* return 0 on success */ { -if (currcons >=MAX_NR_CONSOLES ) +if (currcons >=MAX_NR_CONSOLES || conswitchp ==NULL )return -ENXIO ;if (!vc_cons[currcons].d) {long p, q;
Quoted 5 lines · Pete Zaitcev
I would appreciate if someone would explain me if the attached patch does the right thing. The problem is that I do not use the framebuffer, and use a serial console. Whenever a legacy
/sbin/inittries to open/dev/tty0, the system oopses dereferencing conswitchp invisual_init().
And this worked before?
conswitchp must never be NULL, say `conswitchp = &dummy_con;' in your setup.c if you have a serial console.
Quoted 1 line
From looking at
arch/sparc/kernel/setup.c, perhaps you have
CONFIG_DUMMY_CONSOLE=n?
Quoted 6 lines
-- Pete
diff -ur -X dontdiff
linux-2.5.30-sp_pbk/drivers/char/console.clinux-2.5.30-sparc/drivers/char/console.c
drivers/char/console.c line 658
Quoted 8 lines
drivers/char/console.c +1
-1@@ -652,7 +652,7 @@int vc_allocate (unsigned int currcons)/* return 0 on success */ { -if (currcons >=MAX_NR_CONSOLES ) +if (currcons >=MAX_NR_CONSOLES || conswitchp ==NULL )return -ENXIO ;if (!vc_cons[currcons].d) {long p, q;
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 8 lines · Geert Uytterhoeven
Quoted 5 lines · Pete Zaitcev
I would appreciate if someone would explain me if the attached patch does the right thing. The problem is that I do not use the framebuffer, and use a serial console. Whenever a legacy
/sbin/inittries to open/dev/tty0, the system oopses dereferencing conswitchp invisual_init().And this worked before?
I was simillary surprised when it happened (between 2.5.25 and 2.5.26 if my memory serves correctly).
Quoted 2 lines
conswitchp must never be NULL, say `conswitchp =
&dummy_con;' in yoursetup.cif you have a serial console.
No, it does not work that way for very loooong... Just remove VGA device from your box, VGA con_startup will fail and conswitchp will become NULL... And in 2.5.26 more than 50% of archs (including i386) does not use dummy_con, it leaves conswitchp uninitialized (== NULL).
Quoted 5 lines
Quoted 5 lines
diff -ur -X dontdiff
linux-2.5.30-sp_pbk/drivers/char/console.clinux-2.5.30-sparc/drivers/char/console.cdrivers/char/console.c +0
-0@@ -652,7 +652,7 @@
Quoted 7 lines
drivers/char/console.c line 658
Quoted 7 lines
drivers/char/console.c +1
-1int vc_allocate (unsigned int currcons)/* return 0 on success */ { -if (currcons >=MAX_NR_CONSOLES ) +if (currcons >=MAX_NR_CONSOLES || conswitchp ==NULL )return -ENXIO ;if (!vc_cons[currcons].d) {long p, q;
In 2.5.25 con_init and vty_init was one function, which checked conswitchp == NULL at beginning. In 2.5.26 it was spilt down, and vty_init does no conswitchp checking, it blindly registers console tty driver. Proper fix is putting
if (!conswitchp) return;
at the beginning of vty_init(), unless we support hotplug tty. If we support hotplug tty, then your fix is probably correct, but it needs deeper inspection, as no tty code ever expected conswitchp == NULL.
Petr Vandrovec [email protected]
Quoted 16 lines
Date: Mon, 19 Aug 2002 14:36:25 +0200 (MEST)
From: Geert Uytterhoeven <[email protected]>drivers/char/console.c line 655
Quoted 10 lines
I would appreciate if someone would explain me if the attached patch does the right thing. The problem is that I do not use the framebuffer, and use a serial console. Whenever a legacy
/sbin/inittries to open/dev/tty0, the system oopses dereferencing conswitchp invisual_init().int
vc_allocate(unsigned int currcons)/* return 0 on success */
{drivers/char/console.c +1
-1-if (currcons >=MAX_NR_CONSOLES ) +if (currcons >=MAX_NR_CONSOLES || conswitchp ==NULL )And this worked before?
Quoted 5 lines
conswitchp must never be NULL, say `conswitchp =
&dummy_con;' in yoursetup.cif you have a serial console.Quoted 1 line
From looking at
arch/sparc/kernel/setup.c, perhaps you have
CONFIG_DUMMY_CONSOLE=n?
This only works if CONFIG_FB is present, and I do not want to add one more useless chunk of code to the build. All my boxes have serial consoles (like I said, I would throw CONFIG_VT away if only it was not welded into the rest of the code so well).
-- Pete
From: Pete Zaitcev <[email protected]>
Date: Sat, 24 Aug 2002 00:57:56 -0400
Quoted 1 line
CONFIG_DUMMY_CONSOLE=n?
This only works if CONFIG_FB is present
Not true, only video/Config.in has this (false) dependency. If you say define_bool CONFIG_DUMMY_CONSOLE=y in Sparc configuration then dummycon.o will be built by itself and it will work.