From: Jan Hendrik Farr <kernel@jfarr.cc>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Philipp Rudo <prudo@redhat.com>,
Lennart Poettering <mzxreary@0pointer.de>,
Pingfan Liu <piliu@redhat.com>,
Jarkko Sakkinen <jarkko@kernel.org>,
Eric Biederman <ebiederm@xmission.com>,
Baoquan He <bhe@redhat.com>, Dave Young <dyoung@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Will Deacon <will@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
kexec@lists.infradead.org, linux-efi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [RFCv2 0/9] UEFI emulator for kexec
Date: Mon, 9 Sep 2024 16:37:01 +0200 [thread overview]
Message-ID: <Zt8IDVMhUw7aAejR@archlinux> (raw)
In-Reply-To: <CAMj1kXHN5NgUJ+wwaZxsKeT4bDHqO6C2CHaALAi7JV5hWVmR2A@mail.gmail.com>
On 09 16:04:50, Ard Biesheuvel wrote:
>
> [...]
>
> kdump has a kexec kernel 'standby' to launch when the kernel panics.
> So for the UKI/EFI payload case, this would imply that the load
> involves running the payload until EBS() and freezing the state.
>
> Whether execution occurs in true user space or in a deprivileged
> kernel context is an implementation detail, imho. We don't want to run
> external code in privileged mode inside the kernel in any case, as
> this would violate lockdown already. But it should be feasible to have
> a EFI compatible layer in the kernel that invokes the EFI entrypoint
> of an image in a way that protects the host kernel. This could be user
> mode on the CPU or perhaps a minimal KVM virtual machine.
This solution is what I'm currently in favor of (besides my original
approach), see: https://lore.kernel.org/kexec/Zt7EbvWjF9WPCYfn@gardel-login/T/#md4f02b7cb6c694cb28aa8d36fe47a02bd4dc17a4
From the perspective of supporting UKIs the EFI compatibility layer
definetly has to be run in the kernel not in regular userspace so that
the chain of trust is maintained.
Why do you say that it would have to be a deprivileged kernel context
though? In lockdown mode we would enforce a signature check on the PE
file, so it shouldn't be any different from loading a signed kernel
module from a kernel lockdown perspective, right?
Using KVM is actually something I didn't consider yet, however it would
not work in VMs without nested virtualization.
> The advantage of this approach is that the whole concept of purgatory
> can be avoided - the EFI boot phase runs in parallel with the previous
> kernel, which has full control over authentication and [emulated] PCR
> externsion, and has ultimate control over whether the kexec reboot is
> permitted.
I'm under the impression that we still need some code to run between the
kernels to do two things:
1. Clean up the address space, so that it's what the EFI binary expects
2. Verify a checksum on the saved state in case a kernel panic is the
result of memory corruption
Sure, the majority of the work (running the EFI binary until EBS()) is
done while the old kernel is still running.
>
> [...]
>
> I don't think intermediate kernels are the solution here. We need to
> run as much as possible under the control of the preceding kernel, and
> minimize the bare metal handover that occurs after EBS(). Adding more
> code to the purgatory (as this series does) is not acceptable to me,
> as it is extremely difficult to debug, and duplicates drivers and
> other logic (making it an 'intermediate kernel' of sorts already)
I agree
>
> Today, UKI functionality is implemented in terms of EFI API calls. Any
> solution that needs either a parallel implementation (eBPF vs EFI) or
> needs to unpack the UKI in order to perform the steps that the UKI
> would perform itself if it were executed in an EFI environment is a
> no-go in my opinion.
>
> So either we provide some EFI compatible runtime sufficient to run a
> UKI, or we re-engineer UKI to be built on top of an abstraction that
> can be implemented straight-forwardly both on system firmware and in
> the EFI context.
A solution that can boot UKIs as they exist today is definetly the right
choice. Rewriting them for eBPF and maintaining two implementations is
way less than ideal.
next prev parent reply other threads:[~2024-09-09 14:37 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-19 14:53 [RFCv2 0/9] UEFI emulator for kexec Pingfan Liu
2024-08-19 14:53 ` [RFCv2 1/9] efi/libstub: Ask efi_random_alloc() to skip unusable memory Pingfan Liu
2024-08-19 18:00 ` Jarkko Sakkinen
2024-08-20 0:58 ` Pingfan Liu
2024-08-28 13:28 ` Ard Biesheuvel
2024-08-19 14:53 ` [RFCv2 2/9] efi/libstub: Complete efi_simple_text_output_protocol Pingfan Liu
2024-08-19 14:53 ` [RFCv2 3/9] efi/emulator: Initial rountines to emulate EFI boot time service Pingfan Liu
2024-08-19 14:53 ` [RFCv2 4/9] efi/emulator: Turn on mmu for arm64 Pingfan Liu
2024-08-19 14:53 ` [RFCv2 5/9] kexec: Introduce kexec_pe_image to parse and load PE file Pingfan Liu
2024-08-19 14:53 ` [RFCv2 6/9] arm64: kexec: Introduce a new member param_mem to kimage_arch Pingfan Liu
2024-08-19 14:53 ` [RFCv2 7/9] arm64: mm: Change to prototype of Pingfan Liu
2024-08-19 14:53 ` [RFCv2 8/9] arm64: kexec: Prepare page table for emulator Pingfan Liu
2024-08-19 14:53 ` [RFCv2 9/9] arm64: kexec: Enable kexec_pe_image Pingfan Liu
2024-08-21 14:27 ` [RFCv2 0/9] UEFI emulator for kexec Lennart Poettering
2024-08-22 5:42 ` Pingfan Liu
2024-08-22 6:16 ` Dave Young
2024-08-22 10:51 ` Pingfan Liu
2024-08-22 11:54 ` Dave Young
2024-08-22 10:56 ` Jan Hendrik Farr
2024-08-22 12:04 ` Dave Young
2024-08-22 8:23 ` Lennart Poettering
2024-08-22 10:45 ` Pingfan Liu
2024-08-22 11:42 ` Jan Hendrik Farr
2024-08-22 11:45 ` Lennart Poettering
2024-08-22 14:29 ` Pingfan Liu
2024-08-26 13:39 ` Lennart Poettering
2024-09-09 13:38 ` Pingfan Liu
2024-09-10 7:06 ` Lennart Poettering
2024-08-28 17:08 ` Ard Biesheuvel
2024-09-02 5:40 ` Pingfan Liu
2024-09-06 10:54 ` Philipp Rudo
2024-09-07 11:27 ` Jarkko Sakkinen
2024-09-07 11:31 ` Jarkko Sakkinen
2024-09-07 11:41 ` Jarkko Sakkinen
2024-09-09 13:55 ` Philipp Rudo
2024-09-09 17:09 ` Jarkko Sakkinen
2024-09-09 9:48 ` Lennart Poettering
2024-09-09 10:42 ` Jan Hendrik Farr
2024-09-09 13:49 ` Philipp Rudo
2024-09-09 14:04 ` Ard Biesheuvel
2024-09-09 14:37 ` Jan Hendrik Farr [this message]
2024-09-10 7:54 ` Lennart Poettering
2024-10-08 11:59 ` Pingfan Liu
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=Zt8IDVMhUw7aAejR@archlinux \
--to=kernel@jfarr.cc \
--cc=ardb@kernel.org \
--cc=bhe@redhat.com \
--cc=catalin.marinas@arm.com \
--cc=dyoung@redhat.com \
--cc=ebiederm@xmission.com \
--cc=jarkko@kernel.org \
--cc=kexec@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mzxreary@0pointer.de \
--cc=piliu@redhat.com \
--cc=prudo@redhat.com \
--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