lkml.org 
[lkml]   [2020]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] printk: handle blank console arguments passed in.
From
Date
On 10/7/20 5:30 AM, Sergey Senozhatsky wrote:
[ ... ]
>
> console_on_rootfs() attempts to filp_open()->tty_open() /dev/console.
> This ends up in printk's console_device(), which iterates the list of
> console drivers and returns associated console->device back to tty. The
> problem is that console drivers list is empty, so the function returns
> NULL, and filp_open("/dev/console") fails. But the console_on_rootfs()
> comment says that this function should never fail (!). This sort of
> makes me wonder if "console=" is actually legal.
>
I would not want to use a term such as "legal". It just happened to work
and was used.

> Hint: I can crash my laptop when I remove the "console=" boot param and
> comment out init_dup(file) calls in console_on_rootfs().
>

I can see to options: Link /dev/console to /dev/null if there is no console,
or do something like

if (IS_ERR(file)) {
pr_warn("Warning: unable to open an initial console.\n");
file = filp_open("/dev/null", O_RDWR, 0);
if (IS_ERR(file))
return;
}

Guenter

\
 
 \ /
  Last update: 2020-10-07 17:57    [W:0.193 / U:1.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site