Skip to content

Commit b8dd8d2

Browse files
committed
[secure boot]Add support of secure warm-boot by forcing kexec to verify kernel when loading new one.
1 parent a2520e6 commit b8dd8d2

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

scripts/fast-reboot

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,13 @@ function load_kernel() {
447447
/sbin/kexec -a -l "$KERNEL_IMAGE" --initrd="$INITRD" --append="$BOOT_OPTIONS"
448448
}
449449
450+
function load_kernel_secure() {
451+
# Load kernel into the memory secure
452+
# -s flag is for enforcing the new load kernel(vmlinuz) to be signed and verify.
453+
# not using -a flag, this flag can fallback to an old kexec load that do not support Secure Boot verification
454+
/sbin/kexec -l "$KERNEL_IMAGE" --initrd="$INITRD" --append="$BOOT_OPTIONS" -s
455+
}
456+
450457
function unload_kernel()
451458
{
452459
# Unload the previously loaded kernel if any loaded
@@ -597,9 +604,13 @@ if [[ "$sonic_asic_type" == "mellanox" ]]; then
597604
fi
598605
fi
599606
607+
# check if secure boot is enable in UEFI
608+
SECURE_UPGRADE_ENABLED=$(bootctl status 2>/dev/null | grep -c "Secure Boot: enabled")
600609
601610
if is_secureboot && grep -q aboot_machine= /host/machine.conf; then
602611
load_aboot_secureboot_kernel
612+
elif [ ${SECURE_UPGRADE_ENABLED} -eq 1 ]; then
613+
load_kernel_secure
603614
else
604615
load_kernel
605616
fi

0 commit comments

Comments
 (0)