summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2017-03-24 19:42:57 -0400
committerPeter Jones <pjones@redhat.com>2017-04-03 14:53:45 -0400
commit7a44b29edcf9f6846376e3875dd34636b2d82c80 (patch)
tree8bf2a99fff69a434293436580f022859dc53abae
parent7bfe98b1e22fa6dcce4296f8fd474823ab9537f4 (diff)
downloadefi-boot-shim-7a44b29edcf9f6846376e3875dd34636b2d82c80.tar.gz
efi-boot-shim-7a44b29edcf9f6846376e3875dd34636b2d82c80.zip
Ignore BDS when it tells us we got our own path on the command line.
Sometimes we get our own path in LoadOptions for no clear reason. Don't execute it, just ignore it. Signed-off-by: Peter Jones <pjones@redhat.com>
-rw-r--r--shim.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/shim.c b/shim.c
index dfae265d..289ca018 100644
--- a/shim.c
+++ b/shim.c
@@ -2317,6 +2317,24 @@ get_load_option_optional_data(UINT8 *data, UINTN data_size,
return EFI_SUCCESS;
}
+static int is_our_path(EFI_LOADED_IMAGE *li, CHAR16 *path, UINTN len)
+{
+ CHAR16 *dppath = NULL;
+ int ret = 1;
+
+ dppath = DevicePathToStr(li->FilePath);
+ if (!dppath)
+ return 0;
+
+ Print(L"dppath: %s\n", dppath);
+ Print(L"path: %s\n", path);
+ if (StrnCaseCmp(dppath, path, len))
+ ret = 0;
+
+ FreePool(dppath);
+ return ret;
+}
+
/*
* Check the load options to specify the second stage loader
*/
@@ -2486,6 +2504,20 @@ EFI_STATUS set_second_stage (EFI_HANDLE image_handle)
return EFI_SUCCESS;
/*
+ * And then I found a version of BDS that gives us our own path in
+ * LoadOptions:
+
+77162C58 5c 00 45 00 46 00 49 00 |\.E.F.I.|
+77162C60 5c 00 42 00 4f 00 4f 00 54 00 5c 00 42 00 4f 00 |\.B.O.O.T.\.B.O.|
+77162C70 4f 00 54 00 58 00 36 00 34 00 2e 00 45 00 46 00 |O.T.X.6.4...E.F.|
+77162C80 49 00 00 00 |I...|
+
+ * which is just cruel... So yeah, just don't use it.
+ */
+ if (strings == 1 && is_our_path(li, start, loader_len))
+ return EFI_SUCCESS;
+
+ /*
* Set up the name of the alternative loader and the LoadOptions for
* the loader
*/