diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2020-02-28 15:14:06 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2020-02-29 12:16:57 +0300 |
commit | 0698fac4ac2ae84ecec2a826cc97803af564aa95 (patch) | |
tree | adf7c7d1ba7306f1fcfb7171ed9b0c78c67d34ae /arch/arm/boot/compressed/head.S | |
parent | 98649365e59da18221850e137620d18b50ec99e5 (diff) | |
download | linux-0698fac4ac2ae84ecec2a826cc97803af564aa95.tar.xz |
efi/arm: Clean EFI stub exit code from cache instead of avoiding it
The following commit:
c7225494b ("efi/arm: Work around missing cache maintenance in decompressor handover")
modified the EFI handover code written in assembler to work around the
missing cache maintenance of the piece of code that is executed after the
MMU and caches are turned off.
Due to the fact that this sequence incorporates a subroutine call, cleaning
that code from the cache is not a matter of simply passing the start and end of
the currently running subroutine into cache_clean_flush(), which is why
instead, the code jumps across into the cleaned copy of the image.
However, this assumes that this copy is executable, and this means we
expect EFI_LOADER_DATA regions to be executable as well, which is not
a reasonable assumption to make, even if this is true for most UEFI
implementations today.
So change this back, and add a cache_clean_flush() call to cover the
remaining code in the subroutine, and any code it may execute in the
context of cache_off().
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: linux-efi@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: David Hildenbrand <david@redhat.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Link: https://lore.kernel.org/r/20200228121408.9075-5-ardb@kernel.org
Diffstat (limited to 'arch/arm/boot/compressed/head.S')
-rw-r--r-- | arch/arm/boot/compressed/head.S | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 36ffbeecd30b..04f77214f050 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -1452,13 +1452,11 @@ ENTRY(efi_enter_kernel) @ The PE/COFF loader might not have cleaned the code we are @ running beyond the PoU, and so calling cache_off below from - @ inside the PE/COFF loader allocated region is unsafe. Let's - @ assume our own zImage relocation code did a better job, and - @ jump into its version of this routine before proceeding. - ldr r1, .Ljmp - sub r1, r7, r1 - mov pc, r1 @ no mode switch -0: + @ inside the PE/COFF loader allocated region is unsafe unless + @ we explicitly clean it to the PoC. + adr r0, call_cache_fn @ region of code we will + adr r1, 0f @ run with MMU off + bl cache_clean_flush bl cache_off @ Set parameters for booting zImage according to boot protocol @@ -1467,10 +1465,10 @@ ENTRY(efi_enter_kernel) mov r0, #0 mov r1, #0xFFFFFFFF mov r2, r4 - b __efi_start + add r7, r7, #(__efi_start - start) + mov pc, r7 @ no mode switch ENDPROC(efi_enter_kernel) - .align 2 -.Ljmp: .long start - 0b +0: #endif .align |