[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <be66237b-e7b2-0321-c00c-cd6fba6e3b58@roeck-us.net>
Date: Wed, 7 Oct 2020 08:57:06 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Petr Mladek <pmladek@...e.com>
Cc: Shreyas Joshi <shreyas.joshi@...mp.com>, rostedt@...dmis.org,
shreyasjoshi15@...il.com, linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH] printk: handle blank console arguments passed in.
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
Powered by blists - more mailing lists