Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the infrastructure for shim signing & aarch64 support #2292

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

sayanchowdhury
Copy link
Member

@sayanchowdhury sayanchowdhury commented Sep 6, 2024

TODO before merge

  • Bump shim pacakge revision

  • Changelog entries added in the respective changelog/ directory (user-facing change, bug fix, security fix, update)

  • Inspected CI output for image differences: /boot and /usr size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.

@sayanchowdhury sayanchowdhury requested a review from a team September 6, 2024 15:51
@sayanchowdhury sayanchowdhury changed the title Add the infrastructure for shim signing [WIP] Add the infrastructure for shim signing Sep 6, 2024
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pkgcheck will complain about using spaces rather than tabs.

@sayanchowdhury sayanchowdhury changed the title Add the infrastructure for shim signing Add the infrastructure for shim signing & aarch64 support Oct 23, 2024
@sayanchowdhury
Copy link
Member Author

I've pulled in @chewi commits into this PR.

Copy link

Build action triggered: https://github.com/flatcar/scripts/actions/runs/11475028486

sayanchowdhury and others added 27 commits October 24, 2024 23:00
Also adjust to using board packages for shim

Signed-off-by: Sayan Chowdhury <[email protected]>
Unfortunately, it pulls in a number of dependencies.

Signed-off-by: James Le Cuirot <[email protected]>
virt-fw-vars handles X.509 conversion and QCOW2 conversion transparently
and can update all the variables in a single invocation.

Bonus: Asking it to list the variables doesn't cause a segfault due to
the feature not really being implemented. :D

The 00000000-0000-0000-0000-000000000000 owner GUID is what flash-var
used to set, as we didn't specify the -g argument. We will probably be
assigned a real one later.

Signed-off-by: James Le Cuirot <[email protected]>
Gentoo has moved this package so that it can support multiple platforms.
The newer version is needed for Secure Boot support on arm64. This is
newer than the version that QEMU is currently pinned to so unpin it via
the USE flag.

Signed-off-by: James Le Cuirot <[email protected]>
The new arm64 firmware supporting Secure Boot (see next commit) is in
QCOW2 format only, avoiding the extra space taken up by the 64MB
padding. Supporting both raw and QCOW2 images would be messy, so switch
entirely to QCOW2.

Only the 4MB images are in QCOW2 format on amd64, so also switch away
from the 2MB images. 4MB images are now the default for most
distributions as they are needed to apply certain Windows updates.

Signed-off-by: James Le Cuirot <[email protected]>
edk2-bin now supports multiple platforms, including QEMU on arm64, so we
no longer need to use Fedora's build. Note that the Secure Boot
implementation is currently insecure as it lacks SMM, which is needed to
protect the EFI variable store.

Signed-off-by: James Le Cuirot <[email protected]>
Rather than starting with a blank image, reuse the image that already
has the Microsoft certificates and the latest DBX revocation list
applied. Gentoo also applies the Red Hat certificates, which we don't
need, but this is okay.

Signed-off-by: James Le Cuirot <[email protected]>
We initially thought we would need Red Hat's patch set. Then it looked
like we wouldn't because the TPM Event Log appeared to work without it.
We later discovered that on amd64, it only works with Secure Boot
disabled. The patch set also fixes Secure Boot on arm64, which would
have otherwise needed a couple of patches from Canonical.

We have to drop Gentoo's patches because they conflict, but they don't
affect Flatcar anyway.

Signed-off-by: James Le Cuirot <[email protected]>
Kola's logic for choosing BIOS vs EFI isn't too smart, and not
specifying --qemu-ovmf-vars leads to it passing -bios to QEMU. This
doesn't make sense for arm64, but it did work anyway with the old
firmware in raw format. The new firmware in QCOW2 format doesn't work
this way.

Signed-off-by: James Le Cuirot <[email protected]>
We always use the board's GRUB now.

Signed-off-by: James Le Cuirot <[email protected]>
It's from Gentoo commit edd3a55b92fc0f0ccbd3b820d472312795031bb3.
It's from Gentoo commit 473220b48565c9bbcb5fdf405af39f45ac5db5a6.
It's from Gentoo commit baaefb544b1155af8293d7a0fb88f8ce6ec8219a.
It's from Gentoo commit 4d55b1905e6fb870dc851ce65e58bca8870cba59.
It's from Gentoo commit ff81bc618a41b729cf07f91913a087e502f99ffa.
This fix has been submitted to Red Hat. It will hopefully be merged
soon.

Signed-off-by: James Le Cuirot <[email protected]>
These are only needed when you are going to ship DB updates to existing
systems, which we are not going to do. Our EFI variables are only for
testing. End users are expected to use EFI variables provided by their
hosts or hardware vendors. We presumably provided these before because
some PK and KEK does need to be provided, but we can now use the
Microsoft and Red Hat ones provided via Gentoo's edk2 package.

Signed-off-by: James Le Cuirot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ⚒️ In Progress
Development

Successfully merging this pull request may close these issues.

5 participants