All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pingfan Liu <piliu@redhat.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Peter Jones <pjones@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	linux-efi@vger.kernel.org, Will Deacon <will@kernel.org>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Baoquan He <bhe@redhat.com>, Dave Young <dyoung@redhat.com>,
	Eric Biederman <ebiederm@xmission.com>,
	Philipp Rudo <prudo@redhat.com>,
	Jarkko Sakkinen <jarkko@kernel.org>
Subject: Re: [PATCH 1/2] Makefile.zboot: Sign Image before packing into EFI-STUB shell
Date: Mon, 9 Dec 2024 10:47:09 +0800	[thread overview]
Message-ID: <Z1ZaLbZFm9OPRbQi@fedora> (raw)
In-Reply-To: <CAMj1kXGFnwdQZzb_t5kC8nGyDz+MQ0wq6s2oTGNBmV7ebVgSGA@mail.gmail.com>

On Fri, Dec 06, 2024 at 09:03:30AM +0100, Ard Biesheuvel wrote:

Also cc Jan, Philipp, who are also engaged in related topic (UKI)

> (cc Peter, Gerd)
> 
> On Fri, 6 Dec 2024 at 03:10, Pingfan Liu <piliu@redhat.com> wrote:
> >
> > At present, the kexec_file_load of either zboot or UKI kernel relies on
> > the user space to parse and extract the Image, and then pass the Image
> > through that syscall. During this process, the outmost signature on
> > zboot or UKI kernel is stripped and discarded.
> >
> > On the other hand, a secure boot platform enforces the signature
> > verfiication on the kernel image passed through the kexec_file_load
> > syscall. To cater to this requirement, this patch applies signature on
> > the PE format 'Image' before padding.
> >
> 
> The whole point of the EFI zboot format was avoiding the need to sign
> the compressed payload.
> 
> Now, we are back to signing the payload along with the full image
> using PE based tools, even though the payload is intended to be booted
> as a raw image.
> 

I remember that I sent out a zboot image parser in the kernel to tackle
with this signature issue.  But that will complicate the kernel image
parser, as a result, we defer resolving it, and finally we have it
implemented in the user space kexec-tools.

The emergence of UKI makes things more complicated. Jan introduced "UKI
format parser in linux kernel". For arm64, the UKI support in kernel
means that a UKI format parser should be followed by a zboot format
parser. 

So we tried emulator solution instead of parser. ( I have a summary on:
https://github.com/rhkdump/kexec_uefi/blob/main/overview.md)

But either of the emulator methods have their own drawback:
	-1.the purgatory-style method has trouble in the hardware scaling.
	-2.the user space emulator can not ensure the security. (also I
           think it can not resolve the hardware issue since at that time,
           it can not alter the hardware status arbitrarily)


> I'm not sure I see the point of this: EFI zboot is a trivial container
> format which records the compression type and the start and length of
> the payload in its header at a known offset.
> 
> Perhaps we should just make EFI zboot gzip-only, rather than
> supporting 7 different compression methods because that is what the
> legacy decompressors on ARM and x86 support - I struggle to see the
> point of that tbh (even though I implemented that myself)
> 
> That way, the kernel can authenticate the outer PE zboot image as
> usual, and perform the decompression itself, without having to carry
> code for all compression formats it might encounter.
> 

It is always good to keep things simple. But this seems helpless to step
around the kexec_file_load issue.

> (Apologies if we are sending you in circles, but if we get this wrong
> now, we're stuck with another kexec-related maintenance nightmare so I
> really don't want to commit to something tooo hastily)
> 

Although this issue has come full circle, we now have a clear
understanding of its solutions' limitations, advantages, and disadvantages.

Unlike the forecast of this issue about three years ago, we are now
facing real customer pressure.


Thanks,

Pingfan


> -- 
> Ard.


  parent reply	other threads:[~2024-12-09  2:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-06  2:09 [PATCH 0/2] Kexec: Sign Image before packing into EFI STUB Pingfan Liu
2024-12-06  2:09 ` [PATCH 1/2] Makefile.zboot: Sign Image before packing into EFI-STUB shell Pingfan Liu
2024-12-06  8:03   ` Ard Biesheuvel
2024-12-06  9:24     ` Gerd Hoffmann
2024-12-06 10:40       ` Ard Biesheuvel
2024-12-09  2:59       ` Pingfan Liu
2024-12-09 10:10       ` Dave Young
2024-12-09  2:47     ` Pingfan Liu [this message]
2024-12-06  2:09 ` [PATCH 2/2] kexec: Introduce KEXEC_SIGN_IMAGE config option 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=Z1ZaLbZFm9OPRbQi@fedora \
    --to=piliu@redhat.com \
    --cc=ardb@kernel.org \
    --cc=bhe@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=jarkko@kernel.org \
    --cc=kraxel@redhat.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=pjones@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 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.