Files
kernel_arpi/include/linux/console.h
Petr Mladek aff56c67b0 FROMLIST: Revert "init/console: Use ttynull as a fallback when there is no console"
This reverts commit 757055ae8d.

The commit caused that ttynull was used as the default console
on many systems. It happened when there was no console configured
on the command line and ttynull_init() was the first initcall
calling register_console().

The commit fixed a historical problem that have been there for ages.
The primary motivation was the commit 3cffa06aee
("printk/console: Allow to disable console output by using console=""
or console=null"). It provided a clean solution
for a workaround that was widely used and worked only by chance.

This revert causes that the console="" or console=null command line
options will again work only by chance. These options will cause that
a particular console will be preferred and the default (tty) ones
will not get enabled. There will be no console registered at
all. As a result there won't be stdin, stdout, and stderr for
the init process. But it worked exactly this way even before.

The proper solution has to fulfill many conditions:

  + Register ttynull only when explicitly required or as
    the ultimate fallback.

  + ttynull must get associated with /dev/console but it must
    not become preferred console when used as a fallback.
    Especially, it must still be possible to replace it
    by a better console later.

Such a change requires clean up of the register_console() code.
Otherwise, it would be even harder to follow. Especially, the use
of has_preferred_console and CON_CONSDEV flag is tricky. The clean
up is risky. The ordering of consoles is not well defined. And
any changes tend to break existing user settings.

Do the revert at the least risky solution for now.

Fixes: 757055ae8d ("init/console: Use ttynull as a fallback when there is no console")
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20210107164400.17904-2-pmladek@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I839b9bd17c7280b538f04de8d6b08885bb5d6585
2021-01-07 19:45:13 +01:00

7.3 KiB