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: <YgvsqldT1sjfF5lf@alley>
Date:   Tue, 15 Feb 2022 19:10:50 +0100
From:   Petr Mladek <pmladek@...e.com>
To:     Andre Kalb <andre.kalb@....de>
Cc:     john.ogness@...utronix.de, linux-kernel@...r.kernel.org,
        rostedt@...dmis.org, senozhatsky@...omium.org
Subject: Re: [PATCH v2] printk: Set console_set_on_cmdline=1 when
 __add_preferred_console() is called with user_specified == true

On Mon 2022-02-14 14:21:29, Andre Kalb wrote:
> From: Andre Kalb <andre.kalb@....de>
> 
> In case of using console="" or console=null
> set console_set_on_cmdline=1 to disable "stdout-path" node from DT.
> 
> We basically need to set it every time when __add_preferred_console()
> is called with parameter 'user_specified' set.
> Therefore we can move setting it into a helper function that is
> called from __add_preferred_console().
> 
> Suggested-by: Petr Mladek <pmladek@...e.com>
> Signed-off-by: Andre Kalb <andre.kalb@....de>
> ---
> Changelog v1 to v2:
> Move console_set_on_cmdling into separate function set_user_specified(), which is called from
> __add_preferred_console().
> 
> The old patch v1 could be used to backport to stable 5.4 and lower.
> ---
>  kernel/printk/printk.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index 82abfaf3c2aa..3654695ca5d2 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -2324,6 +2324,15 @@ asmlinkage __visible void early_printk(const char *fmt, ...)
>  }
>  #endif
>  

We should add a comment explaining the less obvious behavior as
discussed in the thread. Something like:

> +static void set_user_specified(struct console_cmdline *c, bool user_specified)
> +{
> +	if (!user_specified)
> +		return;
> +
	/*
	 * @c console was defined by the user on the command line.
	 * Do not clear when added twice also by SPCR or the device tree.
	 */
> +	c->user_specified = true;
	/* At least one console defined by the user on the command line. */
> +	console_set_on_cmdline = 1;
> +}
> +
>  static int __add_preferred_console(char *name, int idx, char *options,
>  				   char *brl_options, bool user_specified)
>  {

With the above comments:

Reviewed-by: Petr Mladek <pmladek@...e.com>

Sergey, is it enough from your POV, please?

Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ