|
Message-ID: <nycvar.YSQ.7.76.1709041246410.8603@knanqh.ubzr> Date: Mon, 4 Sep 2017 12:47:16 -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 10/29] ARM: head.S: use PC-relative insn sequences for __fixup_pv_table On Sun, 3 Sep 2017, Ard Biesheuvel wrote: > Replace the open coded PC relative offset calculations with adr_l > and mov_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 | 27 ++++++-------------- > 1 file changed, 8 insertions(+), 19 deletions(-) > > diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S > index db6b823f20a4..f607e290ef4b 100644 > --- a/arch/arm/kernel/head.S > +++ b/arch/arm/kernel/head.S > @@ -578,14 +578,11 @@ ENDPROC(fixup_smp) > */ > __HEAD > __fixup_pv_table: > - adr r0, 1f > - ldmia r0, {r3-r7} > + adr_l r6, __pv_phys_pfn_offset > + adr_l r7, __pv_offset @ __pa(__pv_offset) > + mov_l r3, __pv_offset @ __va(__pv_offset) > mvn ip, #0 > - subs r3, r0, r3 @ PHYS_OFFSET - PAGE_OFFSET > - add r4, r4, r3 @ adjust table start address > - add r5, r5, r3 @ adjust table end address > - add r6, r6, r3 @ adjust __pv_phys_pfn_offset address > - add r7, r7, r3 @ adjust __pv_offset address > + subs r3, r7, r3 @ PHYS_OFFSET - PAGE_OFFSET > mov r0, r8, lsr #PAGE_SHIFT @ convert to PFN > str r0, [r6] @ save computed PHYS_OFFSET to __pv_phys_pfn_offset > strcc ip, [r7, #HIGH_OFFSET] @ save to __pv_offset high bits > @@ -594,20 +591,15 @@ __fixup_pv_table: > THUMB( it ne @ cross section branch ) > bne __error > str r3, [r7, #LOW_OFFSET] @ save to __pv_offset low bits > + adr_l r4, __pv_table_begin > + adr_l r5, __pv_table_end > b __fixup_a_pv_table > ENDPROC(__fixup_pv_table) > - > - .align > -1: .long . > - .long __pv_table_begin > - .long __pv_table_end > -2: .long __pv_phys_pfn_offset > - .long __pv_offset > + .ltorg > > .text > __fixup_a_pv_table: > - adr r0, 3f > - ldr r6, [r0] > + mov_l r6, __pv_offset > add r6, r6, r3 > ldr r0, [r6, #HIGH_OFFSET] @ pv_offset high word > ldr r6, [r6, #LOW_OFFSET] @ pv_offset low word > @@ -676,9 +668,6 @@ ARM_BE8(rev16 ip, ip) > #endif > ENDPROC(__fixup_a_pv_table) > > - .align > -3: .long __pv_offset > - > ENTRY(fixup_pv_table) > stmfd sp!, {r4 - r7, lr} > mov r3, #0 @ no offset > -- > 2.11.0 > >
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.