diff options
| author | Peter Jones <pjones@redhat.com> | 2017-03-24 19:42:57 -0400 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2017-04-03 14:53:45 -0400 |
| commit | 7a44b29edcf9f6846376e3875dd34636b2d82c80 (patch) | |
| tree | 8bf2a99fff69a434293436580f022859dc53abae /shim.c | |
| parent | 7bfe98b1e22fa6dcce4296f8fd474823ab9537f4 (diff) | |
| download | efi-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>
Diffstat (limited to 'shim.c')
| -rw-r--r-- | shim.c | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -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 */ |
