Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 4 Sep 2017 12:08:25 -0400 (EDT)
From: Nicolas Pitre <nicolas.pitre@...aro.org>
To: Ard Biesheuvel <ard.biesheuvel@...aro.org>
cc: linux-arm-kernel@...ts.infradead.org, kernel-hardening@...ts.openwall.com, 
    Arnd Bergmann <arnd@...db.de>, Russell King <linux@...linux.org.uk>, 
    Kees Cook <keescook@...omium.org>, Thomas Garnier <thgarnie@...gle.com>, 
    Marc Zyngier <marc.zyngier@....com>, Mark Rutland <mark.rutland@....com>, 
    Tony Lindgren <tony@...mide.com>, Matt Fleming <matt@...eblueprint.co.uk>, 
    Dave Martin <dave.martin@....com>
Subject: Re: [PATCH v2 05/29] ARM: head-common.S: use PC-relative insn sequence
 for idmap creation

On Sun, 3 Sep 2017, Ard Biesheuvel wrote:

> Replace the open coded PC relative offset calculations involving
> __turn_mmu_on and __turn_mmu_on_end with a pair of adr_l invocations.
> This ensures these quantities are invariant under runtime relocation.
> 
> Cc: Russell King <linux@...linux.org.uk>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@...aro.org>

Acked-by: Nicolas Pitre <nico@...aro.org>

> ---
>  arch/arm/kernel/head.S | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
> index 04286fd9e09c..0a98aec0e39d 100644
> --- a/arch/arm/kernel/head.S
> +++ b/arch/arm/kernel/head.S
> @@ -227,11 +227,8 @@ __create_page_tables:
>  	 * Create identity mapping to cater for __enable_mmu.
>  	 * This identity mapping will be removed by paging_init().
>  	 */
> -	adr	r0, __turn_mmu_on_loc
> -	ldmia	r0, {r3, r5, r6}
> -	sub	r0, r0, r3			@ virt->phys offset
> -	add	r5, r5, r0			@ phys __turn_mmu_on
> -	add	r6, r6, r0			@ phys __turn_mmu_on_end
> +	adr_l	r5, __turn_mmu_on		@ _pa(__turn_mmu_on)
> +	adr_l	r6, __turn_mmu_on_end		@ _pa(__turn_mmu_on_end)
>  	mov	r5, r5, lsr #SECTION_SHIFT
>  	mov	r6, r6, lsr #SECTION_SHIFT
>  
> @@ -354,11 +351,6 @@ __create_page_tables:
>  	ret	lr
>  ENDPROC(__create_page_tables)
>  	.ltorg
> -	.align
> -__turn_mmu_on_loc:
> -	.long	.
> -	.long	__turn_mmu_on
> -	.long	__turn_mmu_on_end
>  
>  #if defined(CONFIG_SMP)
>  	.text
> -- 
> 2.11.0
> 
> 

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.