Accepting request 900008 from home:gary_lin:branches:devel:openSUSE:Factory

ignore the odd LoadOptions length (bsc#1185232)

OBS-URL: https://build.opensuse.org/request/show/900008
OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory/shim?expand=0&rev=183
This commit is contained in:
Gary Ching-Pang Lin 2021-06-15 03:59:23 +00:00 committed by Git OBS Bridge
parent b088ad9ddf
commit b128f342b9
3 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From 795c62cb023886d39f1ee15977dc3194e01da57f Mon Sep 17 00:00:00 2001
From: Gary Lin <glin@suse.com>
Date: Fri, 4 Jun 2021 17:02:31 +0800
Subject: [PATCH] shim: don't fail on the odd LoadOptions length
Some firmware feeds the LoadOptions with an odd length when booting from
an USB device(*). We should only skip this kind of LoadOptions, not fail
it, or the user won't be able to boot the system from USB or CD-ROM.
(*) https://bugzilla.suse.com/show_bug.cgi?id=1185232#c62
Signed-off-by: Gary Lin <glin@suse.com>
---
shim.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/shim.c b/shim.c
index c5cfbb83..dd563cf6 100644
--- a/shim.c
+++ b/shim.c
@@ -1411,9 +1411,16 @@ EFI_STATUS set_second_stage (EFI_HANDLE image_handle)
return efi_status;
}
- /* Sanity check since we make several assumptions about the length */
+ /* Sanity check since we make several assumptions about the length
+ * Some firmware feeds the following load option when booting from
+ * an USB device:
+ *
+ * 0x46 0x4a 0x00 |FJ.|
+ *
+ * The string is meaningless for shim and so just ignore it.
+ * */
if (li->LoadOptionsSize % 2 != 0)
- return EFI_INVALID_PARAMETER;
+ return EFI_SUCCESS;
/* So, load options are a giant pain in the ass. If we're invoked
* from the EFI shell, we get something like this:
--
2.31.1

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Jun 4 09:22:51 UTC 2021 - Gary Ching-Pang Lin <glin@suse.com>
- Add shim-bsc1185232-relax-loadoptions-length-check.patch to
ignore the odd LoadOptions length (bsc#1185232)
-------------------------------------------------------------------
Fri Jun 4 07:02:03 UTC 2021 - Gary Ching-Pang Lin <glin@suse.com>
@ -36,7 +42,7 @@ Mon May 3 03:46:27 UTC 2021 - Gary Ching-Pang Lin <glin@suse.com>
- Add shim-bsc1185441-fix-handling-of-ignore_db-and-user_insecure_mode.patch
to handle ignore_db and user_insecure_mode correctly
(bsc#1185441)
(bsc#1185441, bsc#1187071)
-------------------------------------------------------------------
Wed Apr 28 09:28:30 UTC 2021 - Gary Ching-Pang Lin <glin@suse.com>

View File

@ -83,6 +83,8 @@ Patch7: shim-bsc1185441-fix-handling-of-ignore_db-and-user_insecure_mode
Patch8: shim-bsc1185621-relax-max-var-sz-check.patch
# PATCH-FIX-UPSTREAM shim-bsc1185261-relax-import_mok_state_check.patch bsc#1185261 glin@suse.com -- Relax the check for import_mok_state() when Secure Boot is off
Patch9: shim-bsc1185261-relax-import_mok_state-check.patch
# PATCH-FIX-UPSTREAM shim-bsc1185232-relax-loadoptions-length-check.patch bsc#1185232 glin@suse.com -- Relax the check for the LoadOptions length
Patch10: shim-bsc1185232-relax-loadoptions-length-check.patch
BuildRequires: dos2unix
BuildRequires: mozilla-nss-tools
BuildRequires: openssl >= 0.9.8
@ -130,6 +132,7 @@ The source code of UEFI shim loader
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%build
# generate the vendor SBAT metadata