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] [day] [month] [year] [list]
Message-Id: <a012763d-d1d4-4e70-b8fc-173b8a915af9@app.fastmail.com>
Date: Wed, 03 Jul 2024 13:07:20 +0800
From: "Jiaxun Yang" <jiaxun.yang@...goat.com>
To: "Huacai Chen" <chenhuacai@...ngson.cn>,
 "Huacai Chen" <chenhuacai@...nel.org>
Cc: loongarch@...ts.linux.dev, "Xuefeng Li" <lixuefeng@...ngson.cn>,
 "Guo Ren" <guoren@...nel.org>, "Xuerui Wang" <kernel@...0n.name>,
 linux-kernel@...r.kernel.org, loongson-kernel@...ts.loongnix.cn
Subject: Re: [PATCH] LoongArch: Use correct API to map cmdline in relocate_kernel()



在2024年7月2日七月 下午11:14,Huacai Chen写道:
> fw_arg1 is in memory space rather than I/O space, so we should use
> early_memremap_ro() instead of early_ioremap() to map the cmdline.
> Moreover, we should unmap it after using.
>
> Suggested-by: Jiaxun Yang <jiaxun.yang@...goat.com>
> Signed-off-by: Huacai Chen <chenhuacai@...ngson.cn>

Reviewed-by: Jiaxun Yang <jiaxun.yang@...goat.com>

Thanks for correcting that.

> ---
>  arch/loongarch/kernel/relocate.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/loongarch/kernel/relocate.c b/arch/loongarch/kernel/relocate.c
> index 1acfa704c8d0..0eddd4a66b87 100644
> --- a/arch/loongarch/kernel/relocate.c
> +++ b/arch/loongarch/kernel/relocate.c
> @@ -13,6 +13,7 @@
>  #include <asm/bootinfo.h>
>  #include <asm/early_ioremap.h>
>  #include <asm/inst.h>
> +#include <asm/io.h>
>  #include <asm/sections.h>
>  #include <asm/setup.h>
> 
> @@ -170,7 +171,7 @@ unsigned long __init relocate_kernel(void)
>  	unsigned long kernel_length;
>  	unsigned long random_offset = 0;
>  	void *location_new = _text; /* Default to original kernel start */
> -	char *cmdline = early_ioremap(fw_arg1, COMMAND_LINE_SIZE); /* Boot 
> command line is passed in fw_arg1 */
> +	char *cmdline = early_memremap_ro(fw_arg1, COMMAND_LINE_SIZE); /* 
> Boot command line is passed in fw_arg1 */
> 
>  	strscpy(boot_command_line, cmdline, COMMAND_LINE_SIZE);
> 
> @@ -182,6 +183,7 @@ unsigned long __init relocate_kernel(void)
>  		random_offset = (unsigned long)location_new - (unsigned long)(_text);
>  #endif
>  	reloc_offset = (unsigned long)_text - VMLINUX_LOAD_ADDRESS;
> +	early_memunmap(cmdline, COMMAND_LINE_SIZE);
> 
>  	if (random_offset) {
>  		kernel_length = (long)(_end) - (long)(_text);
> -- 
> 2.43.0

-- 
- Jiaxun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ