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:   Thu, 4 Feb 2021 16:36:23 +0100
From:   Thomas Bogendoerfer <tsbogend@...ha.franken.de>
To:     Jinyang He <hejinyang@...ngson.cn>
Cc:     Huacai Chen <chenhuacai@...nel.org>,
        Jiaxun Yang <jiaxun.yang@...goat.com>,
        linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] MIPS: relocatable: Use __kaslr_offset in
 show_kernel_relocation

On Wed, Feb 03, 2021 at 06:35:10PM +0800, Jinyang He wrote:
> The type of the VMLINUX_LOAD_ADDRESS macro is the (unsigned long long)
> in 32bits kernel but (unsigned long) in the 64-bit kernel. Although there
> is no error here, avoid using it to calculate kaslr_offset. And here we
> may need is that the address of __kaslr_offset rather than (void *)offset.
> 
> Signed-off-by: Jinyang He <hejinyang@...ngson.cn>
> ---
>  arch/mips/kernel/relocate.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/mips/kernel/relocate.c b/arch/mips/kernel/relocate.c
> index 95abb9c..52018a3 100644
> --- a/arch/mips/kernel/relocate.c
> +++ b/arch/mips/kernel/relocate.c
> @@ -430,13 +430,9 @@ void *__init relocate_kernel(void)
>   */
>  static void show_kernel_relocation(const char *level)
>  {
> -	unsigned long offset;
> -
> -	offset = __pa_symbol(_text) - __pa_symbol(VMLINUX_LOAD_ADDRESS);
> -
> -	if (IS_ENABLED(CONFIG_RELOCATABLE) && offset > 0) {
> +	if (__kaslr_offset > 0) {
>  		printk(level);
> -		pr_cont("Kernel relocated by 0x%pK\n", (void *)offset);
> +		pr_cont("Kernel relocated by 0x%pK\n", &__kaslr_offset);

are you sure ? I would have expected (void *)__kaslr_offset here.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ