From: Atish Patra <atishp@atishpatra.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: mark.rutland@arm.com, linux-efi@vger.kernel.org,
catalin.marinas@arm.com, nivedita@alum.mit.edu,
Jonathan.Cameron@huawei.com, will@kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 0/8] efi/libstub: simplify arm64 kernel image loading
Date: Mon, 13 Apr 2020 14:53:58 -0700 [thread overview]
Message-ID: <CAOnJCULxNtk99sudMD5Rn5ao0orwcarOAwg7NPXMK6ZdXmwNOA@mail.gmail.com> (raw)
In-Reply-To: <20200413155521.24698-1-ardb@kernel.org>
On Mon, Apr 13, 2020 at 8:55 AM Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On arm64, the kernel image used to be virtually mapped via the linear
> region, making the two mappings correlated in a way that required the
> kernel to be located at the start of the linear region, or the memory
> below would not be accessible. For this reason, the EFI stub loader
> code for arm64 has the notion of a 'preferred offset' for the physical
> placement of the kernel image, and tries to put the kernel there, or
> at least as low as possible in physical memory (unless KASLR is active,
> in which case the placement is randomized)
>
> When KASLR was introduced, the virtual mapping of the kernel was moved
> into the vmalloc region, and now, regardless of whether KASLR support
> is built in or active, the kernel can be placed anywhere in physical
> memory without any detrimental side effects on the linear region.
>
> This means that we can drop the notion of 'preferred offset' entirely,
> and invoke the kernel in place if the PE/COFF loader loaded it at the
> right offset. If not, we can invoke the ordinary UEFI top down page
> allocator to reallocate it elsewhere in memory. By updating the PE/COFF
> metadata, we can inform the PE/COFF loader about the desired alignment,
> making it less likely that we need to move the kernel image in the first
> place.
>
> Ard Biesheuvel (8):
> efi/libstub/random: align allocate size to EFI_ALLOC_ALIGN
> efi/libstub/random: increase random alloc granularity
> efi/libstub/arm64: replace 'preferred' offset with alignment check
> efi/libstub/arm64: simplify randomized loading of kernel image
> efi/libstub/arm64: align PE/COFF sections to segment alignment
> efi/libstub: add API function to allocate aligned memory
> efi/libstub/arm64: switch to ordinary page allocator for kernel image
> efi/libstub: move efi_relocate_kernel() into separate source file
>
> arch/arm64/kernel/efi-header.S | 2 +-
> arch/arm64/kernel/vmlinux.lds.S | 3 +-
> drivers/firmware/efi/libstub/Makefile | 3 +-
> drivers/firmware/efi/libstub/alignedmem.c | 57 ++++++
> drivers/firmware/efi/libstub/arm64-stub.c | 92 +++-------
> drivers/firmware/efi/libstub/efistub.h | 18 +-
> drivers/firmware/efi/libstub/mem.c | 191 +-------------------
> drivers/firmware/efi/libstub/randomalloc.c | 6 +-
> drivers/firmware/efi/libstub/relocate.c | 174 ++++++++++++++++++
> 9 files changed, 280 insertions(+), 266 deletions(-)
> create mode 100644 drivers/firmware/efi/libstub/alignedmem.c
> create mode 100644 drivers/firmware/efi/libstub/relocate.c
>
> --
> 2.17.1
>
Oops. I just noticed this series after I sent out a v2.
I see that efi_low_alloc is removed now and the handle_kernel_image is
simplified for arm64.
I will update the risc-v uefi series accordingly. Sorry for the noise.
--
Regards,
Atish
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-04-13 21:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-13 15:55 [PATCH v2 0/8] efi/libstub: simplify arm64 kernel image loading Ard Biesheuvel
2020-04-13 15:55 ` [PATCH v2 1/8] efi/libstub/random: align allocate size to EFI_ALLOC_ALIGN Ard Biesheuvel
2020-04-13 15:55 ` [PATCH v2 2/8] efi/libstub/random: increase random alloc granularity Ard Biesheuvel
2020-04-13 15:55 ` [PATCH v2 3/8] efi/libstub/arm64: replace 'preferred' offset with alignment check Ard Biesheuvel
2020-04-14 23:21 ` Atish Patra
2020-04-15 7:42 ` Ard Biesheuvel
2020-04-13 15:55 ` [PATCH v2 4/8] efi/libstub/arm64: simplify randomized loading of kernel image Ard Biesheuvel
2020-04-13 15:55 ` [PATCH v2 5/8] efi/libstub/arm64: align PE/COFF sections to segment alignment Ard Biesheuvel
2020-04-22 9:39 ` Ard Biesheuvel
2020-04-28 15:11 ` Will Deacon
2020-04-13 15:55 ` [PATCH v2 6/8] efi/libstub: add API function to allocate aligned memory Ard Biesheuvel
2020-04-14 23:46 ` Atish Patra
2020-04-13 15:55 ` [PATCH v2 7/8] efi/libstub/arm64: switch to ordinary page allocator for kernel image Ard Biesheuvel
2020-04-13 15:55 ` [PATCH v2 8/8] efi/libstub: move efi_relocate_kernel() into separate source file Ard Biesheuvel
2020-04-13 21:53 ` Atish Patra [this message]
2020-04-14 7:22 ` [PATCH v2 0/8] efi/libstub: simplify arm64 kernel image loading 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=CAOnJCULxNtk99sudMD5Rn5ao0orwcarOAwg7NPXMK6ZdXmwNOA@mail.gmail.com \
--to=atishp@atishpatra.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=nivedita@alum.mit.edu \
--cc=will@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).