Skip to content

[WIP] [amd64-v6.18.55-generic] Secure Boot: dm-verity platform keyring, lockdown, signed kexec - #299

Draft
eriknordmark wants to merge 4 commits into
lf-edge:eve-kernel-amd64-v6.18.55-genericfrom
eriknordmark:eve-secureboot-6.18.55
Draft

eriknordmark wants to merge 4 commits into
lf-edge:eve-kernel-amd64-v6.18.55-genericfrom
eriknordmark:eve-secureboot-6.18.55

Conversation

@eriknordmark

Copy link
Copy Markdown
Contributor

Description

Kernel side of the two-stage GRUB Secure Boot design (UEFI db + GPG). Under Secure Boot the kernel locks down to integrity, verifies the rootfs dm-verity root hash signature against the UEFI db certificates in the platform keyring, and loads kexec images only with a valid signature. The options are in common.fragment, so core, rt and hwe all get them.

  • rt keeps EFI runtime services, which PREEMPT_RT disables by default; without them the platform keyring is empty and rt cannot boot a signed rootfs.
  • efi-pstore is built in on every flavor, so a panic in the initrd (a rejected root hash) leaves a record for the fallback boot.
  • Non-volatile MokListRT, MokListXRT and MokIgnoreDB are ignored. EVE boots without shim, so root could otherwise create them through efivarfs and add certificates to the platform keyring, or drop db from it, on the next boot.
  • The last commit (TEMP) signs the bzImage with the per-build module-signing key so that kdump's crash kernel loads under KEXEC_SIG_FORCE on images whose kernel has no db signature. It is needed only if EVE keeps kdump rather than moving to pstore.

How to test and validate this PR

Boot EVE with this kernel in QEMU with OVMF Secure Boot (db enrolled) and swtpm, with a dm-verity rootfs whose root hash is signed by a db key, on each of core, rt and hwe:

  • /sys/kernel/security/lockdown shows [integrity], dmesg shows integrity: Loading X.509 certificate: UEFI:db and pstore: Registered efi_pstore.
  • A root hash signed by a key not in db fails with Root hash verification failed (-ENOKEY).
  • A tampered rootfs block gives data block … is corrupted and an I/O error on read.
  • After a failed update, the fallback boot finds the panic record under /sys/fs/pstore.

All four pass on core, rt and hwe built from this branch.

🤖 Generated with Claude Code

https://claude.ai/code/session_011spdBMTKxFnMYus9k6gZc6

@eriknordmark
eriknordmark force-pushed the eve-secureboot-6.18.55 branch from bd149df to 6dec8d4 Compare October 19, 2026 16:32
@eriknordmark
eriknordmark force-pushed the eve-secureboot-6.18.55 branch from 6dec8d4 to 8a37442 Compare October 31, 2026 06:42
eriknordmark added a commit to eriknordmark/eve that referenced this pull request Nov 4, 2026
Builds amd64 core (HV=kvm) against the locally built eve-kernel from
eriknordmark/eve-kernel eve-secureboot-6.18.55 (lf-edge/eve-kernel#299)
until that PR merges. Pinned in kernel-version.mk so the EVE version
carries no kernel suffix.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eriknordmark and others added 4 commits November 12, 2026 09:34
Test build for the two-stage GRUB Secure Boot design on 6.18: dm-verity
with root hash signatures checked against the platform keyring (UEFI db),
kernel lockdown forced to integrity, and signature-verified kexec. In
common.fragment so core, rt and hwe all get them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011spdBMTKxFnMYus9k6gZc6
Signed-off-by: eriknordmark <erik@zededa.com>
PREEMPT_RT turns EFI_DISABLE_RUNTIME on by default, which leaves the rt
kernel without the UEFI db certificates in the .platform keyring and
without efi-pstore. Under Secure Boot that keyring is what dm-verity root
hash signatures and kexec images are verified against, so rt could not
boot a signed rootfs. Firmware calls are not preemptible, so rt pays some
latency when one runs; they happen at boot, on variable access and on
panic, and efi=noruntime still turns them off per device.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011spdBMTKxFnMYus9k6gZc6
Signed-off-by: eriknordmark <erik@zededa.com>
hwe built efi-pstore as a module, so a panic in the initrd, such as a
rejected dm-verity root hash, came before the backend registered and
left no record for the fallback boot to report. Core and rt already
built it in.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011spdBMTKxFnMYus9k6gZc6
Without shim's MOKvar config table, the kernel reads MokListRT,
MokListXRT and MokIgnoreDB as ordinary UEFI variables. On a system that
boots without shim, root can create them through efivarfs, and on the
next boot MokListRT certificates land in the platform keyring, which
dm-verity root hash signatures and kexec_file trust, while MokIgnoreDB
drops db from it. shim creates all three as volatile on every boot, so
ignore a non-volatile copy, as efi_get_secureboot() does for
MokSBStateRT since commit 5f56a74 ("efi: libstub: check Shim mode
using MokSBStateRT").

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011spdBMTKxFnMYus9k6gZc6
eriknordmark added a commit to eriknordmark/eve that referenced this pull request Nov 12, 2026
Builds amd64 core (HV=kvm) and hwe (HV=k) against locally built
eve-kernels from eriknordmark/eve-kernel eve-secureboot-6.18.55
(lf-edge/eve-kernel#299) on 92df24b15f57, until that PR merges. Pinned
in kernel-version.mk so the EVE version carries no kernel suffix.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eriknordmark
eriknordmark force-pushed the eve-secureboot-6.18.55 branch from 8a37442 to 3640e78 Compare November 12, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant