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]
Date:   Mon, 17 Jul 2023 15:05:52 +0800
From:   Huacai Chen <chenhuacai@...nel.org>
To:     Dong Zhihong <donmor3000@...mail.com>
Cc:     kernel@...0n.name, ardb@...nel.org, tangyouling@...ngson.cn,
        zhoubinbin@...ngson.cn, yangtiezhu@...ngson.cn, tglx@...utronix.de,
        loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4] LoongArch: Fix CONFIG_CMDLINE_EXTEND and
 CONFIG_CMDLINE_BOOTLOADER handling

On Mon, Jul 17, 2023 at 2:51 PM Dong Zhihong <donmor3000@...mail.com> wrote:
>
> Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and
> CONFIG_CMDLINE_BOOTLOADER. The touched function is bootcmdline_init()`.
> There's already code handling CONFIG_CMDLINE_FORCE, which replaces
> `boot_command_line` with CONFIG_CMDLINE and immediately`goto out`. It'd be
> similar way to handle CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER,
> so some code is added after OF_FLATTREE part to handle them.
>
> Signed-off-by: Dong Zhihong <donmor3000@...mail.com>
> ---
>
> v4 -> v3: Make CONFIG_CMDLINE appended to the end of command line (Huacai);
>         Removed unnecessary #ifdef since CONFIG_CMDLINE is always a string on
>         LoongArch
>         Reworded comments
>         Reworded the subject of commit message (Huacai)
> v3 -> v2: Reworded the commit message again to make it imperative (Ruoyao)
> v2 -> v1: Reworded the commit message so it's more imperative (Markus);
>         Added `goto out` to FDT part (Huacai)
>
>  arch/loongarch/kernel/setup.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
> index 78a00359bde3..a98f33553acf 100644
> --- a/arch/loongarch/kernel/setup.c
> +++ b/arch/loongarch/kernel/setup.c
> @@ -332,9 +332,26 @@ static void __init bootcmdline_init(char **cmdline_p)
>                         strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
>
>                 strlcat(boot_command_line, init_command_line, COMMAND_LINE_SIZE);
> +               goto out;
>         }
>  #endif
>
> +       /*
> +        * Append built-in command to the retrieved one if
> +        * CONFIG_CMDLINE_EXTEND is enabled.
> +        */
> +       if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) && CONFIG_CMDLINE[0]) {
Don't need to check CONFIG_CMDLINE[0], this simplifies the conditions.

> +               strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
> +               strlcat(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> +               goto out;
Remove this line and in the next line using the old method
(IS_ENABLED(CONFIG_CMDLINE_BOOTLOADER) && !boot_command_line[0]) is
better.

Huacai
> +       }
> +
> +       /*
> +        * Use built-in command line if nothing is retrieved from boot loader.
> +        */
> +       if (!boot_command_line[0])
> +               strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> +
>  out:
>         *cmdline_p = boot_command_line;
>  }
> --
> 2.25.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ