From: Catalin Marinas <catalin.marinas@arm.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-efi@vger.kernel.org, keescook@chromium.org,
Matthew Garrett <mjg59@srcf.ucam.org>,
Peter Jones <pjones@redhat.com>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Atish Patra <atishp@atishpatra.org>,
Arnd Bergmann <arnd@arndb.de>,
Huacai Chen <chenhuacai@loongson.cn>,
Xi Ruoyao <xry111@xry111.site>,
Lennart Poettering <lennart@poettering.net>,
Jeremy Linton <jeremy.linton@arm.com>,
Will Deacon <will@kernel.org>
Subject: Re: [PATCH 01/21] arm64: efi: Move dcache cleaning of loaded image out of efi_enter_kernel()
Date: Tue, 18 Oct 2022 12:54:43 +0100 [thread overview]
Message-ID: <Y06UA9AoImkeJwAu@arm.com> (raw)
In-Reply-To: <CAMj1kXH2_qd=BBiNjGj1-SdJ0_2K6s98kVd10Khb0wxQR=vM7w@mail.gmail.com>
On Tue, Oct 18, 2022 at 01:38:57PM +0200, Ard Biesheuvel wrote:
> On Tue, 18 Oct 2022 at 13:28, Catalin Marinas <catalin.marinas@arm.com> wrote:
> > On Mon, Oct 17, 2022 at 07:16:40PM +0200, Ard Biesheuvel wrote:
> > > diff --git a/arch/arm64/kernel/efi-entry.S b/arch/arm64/kernel/efi-entry.S
> > > index 61a87fa1c305..1c1be004a271 100644
> > > --- a/arch/arm64/kernel/efi-entry.S
> > > +++ b/arch/arm64/kernel/efi-entry.S
> > > @@ -23,15 +23,6 @@ SYM_CODE_START(efi_enter_kernel)
> > > add x19, x0, x2 // relocated Image entrypoint
> > > mov x20, x1 // DTB address
> > >
> > > - /*
> > > - * Clean the copied Image to the PoC, and ensure it is not shadowed by
> > > - * stale icache entries from before relocation.
> > > - */
> > > - ldr w1, =kernel_size
> > > - add x1, x0, x1
> > > - bl dcache_clean_poc
> > > - ic ialluis
> > > -
> > > /*
> > > * Clean the remainder of this routine to the PoC
> > > * so that we can safely disable the MMU and caches.
> > [...]
> > > diff --git a/drivers/firmware/efi/libstub/arm64-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c
> > > index 598c76c4bbaa..e767a5ac8c3d 100644
> > > --- a/drivers/firmware/efi/libstub/arm64-stub.c
> > > +++ b/drivers/firmware/efi/libstub/arm64-stub.c
> > [...]
> > > @@ -174,5 +174,13 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
> > > *image_addr = *reserve_addr;
> > > memcpy((void *)*image_addr, _text, kernel_size);
> > >
> > > +clean_image_to_poc:
> > > + /*
> > > + * Clean the copied Image to the PoC, and ensure it is not shadowed by
> > > + * stale icache entries from before relocation.
> > > + */
> > > + dcache_clean_poc(*image_addr, *image_addr + kernel_size);
> > > + asm("ic ialluis");
> >
> > Does this need some barriers, at least a DSB? The original code had DSB
> > and ISB, though not immediately after the IC instruction.
>
> We are still relying on the implicit DSB done by the subsequent call
> to dcache_clean_to_poc() call in efi_enter_kernel(), which executes
> much later than this code.
Ah, ok.
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
next prev parent reply other threads:[~2022-10-18 11:54 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-17 17:16 [PATCH 00/21] efi: Combine stub functionality with zboot decompressor Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 01/21] arm64: efi: Move dcache cleaning of loaded image out of efi_enter_kernel() Ard Biesheuvel
2022-10-18 11:27 ` Catalin Marinas
2022-10-18 11:38 ` Ard Biesheuvel
2022-10-18 11:54 ` Catalin Marinas [this message]
2022-10-17 17:16 ` [PATCH 02/21] arm64: efi: Avoid dcache_clean_poc() altogether in efi_enter_kernel() Ard Biesheuvel
2022-10-18 11:57 ` Catalin Marinas
2022-10-18 11:59 ` Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 03/21] arm64: efi: Move efi-entry.S into the libstub source directory Ard Biesheuvel
2022-10-18 11:57 ` Catalin Marinas
2022-10-17 17:16 ` [PATCH 04/21] efi: libstub: Remove zboot signing from build options Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 05/21] efi: libstub: Drop randomization of runtime memory map Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 06/21] efi: libstub: Drop handling of EFI properties table Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 07/21] efi: libstub: Deduplicate ftrace command line argument filtering Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 08/21] efi: libstub: Use local strncmp() implementation unconditionally Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 09/21] efi: libstub: Clone memcmp() into the stub Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 10/21] efi: libstub: Enable efi_printk() in zboot decompressor Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 11/21] efi: loongarch: Drop exports of unused string routines Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 12/21] efi: libstub: Move screen_info handling to common code Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 13/21] efi: libstub: Provide local implementations of strrchr() and memchr() Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 14/21] efi: libstub: Factor out EFI stub entrypoint into separate file Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 15/21] efi: libstub: Add image code and data size to the zimage metadata Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 16/21] efi: libstub: Factor out min alignment and preferred kernel load address Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 17/21] efi/riscv: libstub: Split off kernel image relocation for builtin stub Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 18/21] efi/arm64: " Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 19/21] efi/loongarch: Don't jump to kernel entry via the old image Ard Biesheuvel
2022-10-17 17:16 ` [PATCH 20/21] efi/loongarch: libstub: Split off kernel image relocation for builtin stub Ard Biesheuvel
2022-10-17 17:17 ` [PATCH 21/21] efi: libstub: Merge zboot decompressor with the ordinary stub Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y06UA9AoImkeJwAu@arm.com \
--to=catalin.marinas@arm.com \
--cc=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=atishp@atishpatra.org \
--cc=chenhuacai@loongson.cn \
--cc=ilias.apalodimas@linaro.org \
--cc=jeremy.linton@arm.com \
--cc=keescook@chromium.org \
--cc=lennart@poettering.net \
--cc=linux-efi@vger.kernel.org \
--cc=mjg59@srcf.ucam.org \
--cc=palmer@dabbelt.com \
--cc=pjones@redhat.com \
--cc=will@kernel.org \
--cc=xry111@xry111.site \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.