-
Notifications
You must be signed in to change notification settings - Fork 666
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 support of secure warm-boot #2532
Changes from 1 commit
b8dd8d2
0ef8677
4cd2598
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -447,6 +447,13 @@ function load_kernel() { | |
/sbin/kexec -a -l "$KERNEL_IMAGE" --initrd="$INITRD" --append="$BOOT_OPTIONS" | ||
} | ||
|
||
function load_kernel_secure() { | ||
# Load kernel into the memory secure | ||
# -s flag is for enforcing the new load kernel(vmlinuz) to be signed and verify. | ||
# not using -a flag, this flag can fallback to an old kexec load that do not support Secure Boot verification | ||
/sbin/kexec -l "$KERNEL_IMAGE" --initrd="$INITRD" --append="$BOOT_OPTIONS" -s | ||
} | ||
|
||
function unload_kernel() | ||
{ | ||
# Unload the previously loaded kernel if any loaded | ||
|
@@ -597,9 +604,13 @@ if [[ "$sonic_asic_type" == "mellanox" ]]; then | |
fi | ||
fi | ||
|
||
# check if secure boot is enable in UEFI | ||
SECURE_UPGRADE_ENABLED=$(bootctl status 2>/dev/null | grep -c "Secure Boot: enabled") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this var is not needed in aboot secure boot case or it might confuse that we have both SECURE_UPGRADE_ENABLED and is_secureboot There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In our generic flow, we are reading the info about secure boot state from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, that means SECURE_UPGRADE_ENABLED is relevant only in case the platform is not aboot platform, correct? Or same new approach can be used for aboot? If SECURE_UPGRADE_ENABLED is not relevant to aboot I suggest to set this variable under else clause for non aboot platforms to avoid confusion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well, if aboot its not with secure boot they still need load kernel regular, and I dont like to create a complex flow or duplicate code. |
||
|
||
if is_secureboot && grep -q aboot_machine= /host/machine.conf; then | ||
load_aboot_secureboot_kernel | ||
elif [ ${SECURE_UPGRADE_ENABLED} -eq 1 ]; then | ||
load_kernel_secure | ||
else | ||
load_kernel | ||
fi | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be beneficial if we extend
load_kernel
with argument whether to perform sign verification instead of copy/paste most of the kexec parameters here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in my previous implementation, I extended the command, but now it's not possible because was added a new flag that is not secure.
so we need to add and remove flags with the SB use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about? To avoid duplicating kexec line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this one can work, I will add a commit