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: <20210201125028.GA8621@alpha.franken.de>
Date:   Mon, 1 Feb 2021 13:50:28 +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] MIPS: relocatable: Provide kaslr_offset() to get the
 kernel offset

On Wed, Jan 27, 2021 at 12:12:25PM +0800, Jinyang He wrote:
> Use kimage_vaddr to indicate kernel start address. Provide kaslr_offset()
> to get the kernel offset when KASLR is enabled. Error may occur before
> update_kimage_vaddr(), so put it at the end of the offset branch.
> 
> Fixes: a307a4ce9ecd ("MIPS: Loongson64: Add KASLR support")
> Reported-by: kernel test robot <lkp@...el.com>
> Signed-off-by: Jinyang He <hejinyang@...ngson.cn>
> ---
>  arch/mips/include/asm/page.h |  6 ++++++
>  arch/mips/kernel/relocate.c  | 12 ++++++++++++
>  arch/mips/kernel/setup.c     |  3 +++
>  3 files changed, 21 insertions(+)
> 
> diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
> index 6a77bc4..9429520 100644
> --- a/arch/mips/include/asm/page.h
> +++ b/arch/mips/include/asm/page.h
> @@ -255,6 +255,12 @@ extern bool __virt_addr_valid(const volatile void *kaddr);
>  
>  #define VM_DATA_DEFAULT_FLAGS	VM_DATA_FLAGS_TSK_EXEC
>  
> +extern unsigned long kimage_vaddr;
> +static inline unsigned long kaslr_offset(void)
> +{
> +	return kimage_vaddr - VMLINUX_LOAD_ADDRESS;
> +}

this breaks for 32bit kernels:

<command-line>:0:22: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
/local/tbogendoerfer/korg/linux/arch/mips/kernel/setup.c:87:41: note: in expansion of macro ‘VMLINUX_LOAD_ADDRESS’
 unsigned long kimage_vaddr __initdata = VMLINUX_LOAD_ADDRESS;
                                         ^~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

-- 
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