lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vdr1yNamVMP12X2bZs5=PL=R+Lsio5b+ba_NaPOsvzobA@mail.gmail.com>
Date: Wed, 26 Feb 2025 21:22:20 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Adam Simonelli <adamsimonelli@...il.com>
Cc: Petr Mladek <pmladek@...e.com>, linux-serial@...r.kernel.org, 
	linux-kernel@...r.kernel.org, Jiri Slaby <jirislaby@...nel.org>, 
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Steven Rostedt <rostedt@...dmis.org>, 
	John Ogness <john.ogness@...utronix.de>, Sergey Senozhatsky <senozhatsky@...omium.org>
Subject: Re: [PATCH v5 1/2] ttynull: Add an option to allow ttynull to be used
 as a console device

On Wed, Feb 26, 2025 at 3:39 PM Adam Simonelli <adamsimonelli@...il.com> wrote:
> On Tuesday, February 25, 2025 11:19:04 AM EST Petr Mladek wrote:

...

> > My proposal is to call:
> >
> > #ifdef CONFIG_NULL_TTY_DEFAULT_CONSOLE
> >       add_preferred_console("ttynull", 0, NULL);
> > #endif
> >
> > somewhere in the kernel code. The question is where.
> > I wonder if the following would work:
> >
>
> > #ifdef CONFIG_NULL_TTY_DEFAULT_CONSOLE
> > static int __init ttynull_default_console(void)
> > {
> >       add_preferred_console("ttynull", 0, NULL);
> >       return 0;
> > }
> > console_initcall(ttynull_register);
> > #endif
> >
> OK, actually in earlier revisions locally, I did actually have
>
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index dddb15f48d59..c1554a789de8 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -3712,6 +3712,11 @@ void __init console_init(void)
>         initcall_t call;
>         initcall_entry_t *ce;
>
> +#ifdef CONFIG_NULL_TTY_CONSOLE
> +       if (!strstr(boot_command_line, "console="))

Just a side note: strstr() is fragile as theoretically "console=" can
be part of an argument unrelated to the console, like
foo="bar,baz,console=10,key=value". Although I haven't checked if this
is allowed by cmdline parser (lib/cmdline.c).

> +               add_preferred_console("ttynull", 0, NULL);
> +#endif
> +
>         /* Setup the default TTY line discipline. */
>         n_tty_init();
>
>
>
> Which worked as far as I could tell, at least on x86. Not sure if that was the
> right place, and yeah, I was trying to better copy how CONFIG_VT_CONSOLE worked
> because I thought that was more correct.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ