From b128f342b98c42ce32a45b64837ad684dc727ff0fa33c607c804778095012408 Mon Sep 17 00:00:00 2001 From: Gary Ching-Pang Lin Date: Tue, 15 Jun 2021 03:59:23 +0000 Subject: [PATCH] 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 --- ...85232-relax-loadoptions-length-check.patch | 42 +++++++++++++++++++ shim.changes | 8 +++- shim.spec | 3 ++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 shim-bsc1185232-relax-loadoptions-length-check.patch diff --git a/shim-bsc1185232-relax-loadoptions-length-check.patch b/shim-bsc1185232-relax-loadoptions-length-check.patch new file mode 100644 index 0000000..fa4bb6f --- /dev/null +++ b/shim-bsc1185232-relax-loadoptions-length-check.patch @@ -0,0 +1,42 @@ +From 795c62cb023886d39f1ee15977dc3194e01da57f Mon Sep 17 00:00:00 2001 +From: Gary Lin +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 +--- + 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 + diff --git a/shim.changes b/shim.changes index 14572e9..16c05aa 100644 --- a/shim.changes +++ b/shim.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jun 4 09:22:51 UTC 2021 - Gary Ching-Pang Lin + +- 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 @@ -36,7 +42,7 @@ Mon May 3 03:46:27 UTC 2021 - Gary Ching-Pang Lin - 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 diff --git a/shim.spec b/shim.spec index 7f720a6..8fbcd9c 100644 --- a/shim.spec +++ b/shim.spec @@ -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