diff --git a/0205-fix-setupmode-not-available-in-some-machine.patch b/0205-fix-setupmode-not-available-in-some-machine.patch new file mode 100644 index 0000000000000000000000000000000000000000..bfa78299248625576bf91b324e42b0cc70179647 --- /dev/null +++ b/0205-fix-setupmode-not-available-in-some-machine.patch @@ -0,0 +1,48 @@ +From 4fc72f509627da808b452eb1186282237c449b65 Mon Sep 17 00:00:00 2001 +From: fengtao +Date: Tue, 22 Mar 2022 22:22:22 +0800 +Subject: [PATCH] fix setupmode not available in some machine + +In some machine, there is no setupmode variable, so we should +give setupmode a default vaule: setup_mode = 0 + +if we cannot get setupmode variable, we use setup_mode instead. + +--- + grub-core/kern/efi/sb.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/grub-core/kern/efi/sb.c b/grub-core/kern/efi/sb.c +index c52ec62..f58fb13 100644 +--- a/grub-core/kern/efi/sb.c ++++ b/grub-core/kern/efi/sb.c +@@ -50,6 +50,7 @@ grub_efi_get_secureboot (void) + grub_uint8_t *moksbstate = NULL; + grub_uint8_t secureboot = GRUB_EFI_SECUREBOOT_MODE_UNKNOWN; + const char *secureboot_str = "UNKNOWN"; ++ grub_uint8_t setup_mode = 0; + + status = grub_efi_get_variable ("SecureBoot", &efi_variable_guid, + &size, (void **) &secboot); +@@ -67,9 +68,16 @@ grub_efi_get_secureboot (void) + &size, (void **) &setupmode); + + if (status != GRUB_EFI_SUCCESS) +- goto out; ++ { ++ grub_dprintf ("efi", "No SetupMode variable\n"); ++ } ++ else ++ { ++ grub_dprintf ("efi", "SetupMode: %d\n", *setupmode); ++ setup_mode = *setupmode; ++ } + +- if ((*secboot == 0) || (*setupmode == 1)) ++ if ((*secboot == 0) || (setup_mode == 1)) + { + secureboot = GRUB_EFI_SECUREBOOT_MODE_DISABLED; + goto out; +-- +2.23.0 + diff --git a/grub.patches b/grub.patches index a6e69a79d9cff3a145c49b8f9d8c7ac5e8c2aca9..3ac2e1cec0ee6d5758e3bea8a5107374fa9422eb 100644 --- a/grub.patches +++ b/grub.patches @@ -202,3 +202,4 @@ Patch0201: 0201-fs-btrfs-Use-full-btrfs-bootloader-area.patch Patch0202: grub2-set-password-prompts-to-enter-the-current-pass.patch Patch0203: support-TPM2.0.patch Patch0204: use-default-timestamp.patch +Patch0205: 0205-fix-setupmode-not-available-in-some-machine.patch diff --git a/grub2.spec b/grub2.spec index cc9ae2f8a051637ae8fdb3497be9dafc359dfd77..df68227e13ce4d0428ae7f7f2ce7b0ed63a01e25 100644 --- a/grub2.spec +++ b/grub2.spec @@ -14,7 +14,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 1 +Release: 2 Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -426,6 +426,12 @@ fi %{_datadir}/man/man* %changelog +* Tue Mar 22 2022 fengtao - 2.06-2 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:fix setupmode not available in some machine + * Tue Mar 22 2022 zhangqiumiao - 2.06-1 - Type:bugfix - CVE:NA