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: <20200520230103.4b34de53c7d5f62368ca30b5@kernel.org>
Date:   Wed, 20 May 2020 23:01:03 +0900
From:   Masami Hiramatsu <mhiramat@...nel.org>
To:     王程刚 <wangchenggang@...o.com>
Cc:     "'Steven Rostedt \(VMware'" <rostedt@...dmis.org>,
        "'Andrew Morton'" <akpm@...ux-foundation.org>,
        "'Kees Cook'" <keescook@...omium.org>,
        "'Thomas Gleixner'" <tglx@...utronix.de>,
        "'Dominik Brodowski'" <linux@...inikbrodowski.net>,
        "'Arvind Sankar'" <nivedita@...m.mit.edu>,
        "'Mike Rapoport'" <rppt@...ux.ibm.com>,
        "'Alexander Potapenko'" <glider@...gle.com>,
        <linux-kernel@...r.kernel.org>, <kernel@...o.com>
Subject: Re: [PATCH] init/main.c: Print all command line when boot

On Tue, 19 May 2020 11:29:46 +0800
王程刚 <wangchenggang@...o.com> wrote:

> Function pr_notice print max length maybe less than the command line length,
> need more times to print all.
> For example, arm64 has 2048 bytes command line length, but printk maximum
> length is only 1024 bytes.

Good catch, and if you use bootconfig, you can expand it longer than that.

> 
> Signed-off-by: Chenggang Wang <wangchenggang@...o.com>
> ---
>  init/main.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/init/main.c b/init/main.c
> index 03371976d387..4cf676cc3305 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -825,6 +825,16 @@ void __init __weak arch_call_rest_init(void)
>  	rest_init();
>  }
>  
> +static void __init print_cmdline(void)
> +{
> +	const char *prefix = "Kernel command line: ";
> +	int len = -strlen(prefix);
> +
> +	len += pr_notice("%s%s\n", prefix, boot_command_line);

Why don't you use saved_command_line here? Those can be different
and the effective one is saved_command_line.

> +	while (boot_command_line[len])
> +		len += pr_notice("%s\n", &boot_command_line[len]);

Also, don't append "\n" unless you are sure there is an actual
option separator (not a space, because the option can be quoted.)

Thank you,

-- 
Masami Hiramatsu <mhiramat@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ