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:	Fri, 08 Jan 2016 10:17:02 +0000
From:	James Morse <james.morse@....com>
To:	Ard Biesheuvel <ard.biesheuvel@...aro.org>
CC:	linux-arm-kernel@...ts.infradead.org,
	kernel-hardening@...ts.openwall.com, will.deacon@....com,
	catalin.marinas@....com, mark.rutland@....com,
	leif.lindholm@...aro.org, keescook@...omium.org,
	linux-kernel@...r.kernel.org, stuart.yoder@...escale.com,
	bhupesh.sharma@...escale.com, arnd@...db.de, marc.zyngier@....com,
	christoffer.dall@...aro.org
Subject: Re: [PATCH v2 12/13] arm64: add support for relocatable kernel

Hi Ard!

On 30/12/15 15:26, Ard Biesheuvel wrote:
> This adds support for runtime relocation of the kernel Image, by
> building it as a PIE (ET_DYN) executable and applying the dynamic
> relocations in the early boot code.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@...aro.org>
> ---

> diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
> index 01a33e42ed70..ab582ee58b58 100644
> --- a/arch/arm64/kernel/head.S
> +++ b/arch/arm64/kernel/head.S
> @@ -243,6 +253,16 @@ ENDPROC(stext)
>  preserve_boot_args:
>  	mov	x21, x0				// x21=FDT
>  
> +#ifdef CONFIG_ARM64_RELOCATABLE_KERNEL
> +	/*
> +	 * Mask off the bits of the random value supplied in x1 so it can serve
> +	 * as a KASLR displacement value which will move the kernel image to a
> +	 * random offset in the lower half of the VMALLOC area.
> +	 */
> +	mov	x23, #(1 << (VA_BITS - 2)) - 1
> +	and	x23, x23, x1, lsl #SWAPPER_BLOCK_SHIFT
> +#endif

I've managed to make this fail to boot by providing a seed that caused
the kernel to overlap a 1G boundary on a 4K system.

(It looks like your v3 may have the same issue - but I haven't tested it.)


> +
>  	adr_l	x0, boot_args			// record the contents of
>  	stp	x21, x1, [x0]			// x0 .. x3 at kernel entry
>  	stp	x2, x3, [x0, #16]


Thanks!

James

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ