diff options
| author | Jan Setje-Eilers <jan.setjeeilers@oracle.com> | 2024-07-12 17:07:45 -0700 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2025-02-18 10:21:19 -0500 |
| commit | 2b49dc13aed3723c7c841c2788217ff7b0e821df (patch) | |
| tree | e064ba50dd2994343a835767e5038cdab6d51474 /shim.c | |
| parent | c57af36e673b34a9b24309f76f105371316c45be (diff) | |
| download | efi-boot-shim-2b49dc13aed3723c7c841c2788217ff7b0e821df.tar.gz efi-boot-shim-2b49dc13aed3723c7c841c2788217ff7b0e821df.zip | |
Suppress file open failures for some netboot cases
Reading files during a netboot comes with the caveat that
fetching files from a network does not support anything
like listing a directory. In the past this has meant that
we do not try to open optional files during a netboot.
However at least the revocation.efi file is now tested
during a netboot, which will print an error when it is not
found. Since that error is spurious we should allow for
those errors to be suppressed.
This is also desirable since we will likely go looking for
additional files in the near future.
Signed-off-by: Jan Setje-Eilers <Jan.SetjeEilers@oracle.com>
Diffstat (limited to 'shim.c')
| -rw-r--r-- | shim.c | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -1055,7 +1055,8 @@ str16_to_str8(CHAR16 *str16, CHAR8 **str8) * Load and run an EFI executable */ EFI_STATUS read_image(EFI_HANDLE image_handle, CHAR16 *ImagePath, - CHAR16 **PathName, void **data, int *datasize) + CHAR16 **PathName, void **data, int *datasize, + int flags) { EFI_STATUS efi_status; void *sourcebuffer = NULL; @@ -1092,10 +1093,11 @@ EFI_STATUS read_image(EFI_HANDLE image_handle, CHAR16 *ImagePath, } FreePool(netbootname); efi_status = FetchNetbootimage(image_handle, &sourcebuffer, - &sourcesize); + &sourcesize, flags); if (EFI_ERROR(efi_status)) { - perror(L"Unable to fetch TFTP image: %r\n", - efi_status); + if (~flags & SUPPRESS_NETBOOT_OPEN_FAILURE_NOISE) + perror(L"Unable to fetch TFTP image: %r\n", + efi_status); return efi_status; } *data = sourcebuffer; @@ -1107,8 +1109,9 @@ EFI_STATUS read_image(EFI_HANDLE image_handle, CHAR16 *ImagePath, &sourcesize, netbootname); if (EFI_ERROR(efi_status)) { - perror(L"Unable to fetch HTTP image %a: %r\n", - netbootname, efi_status); + if (~flags & SUPPRESS_NETBOOT_OPEN_FAILURE_NOISE) + perror(L"Unable to fetch HTTP image %a: %r\n", + netbootname, efi_status); return efi_status; } *data = sourcebuffer; @@ -1147,7 +1150,7 @@ EFI_STATUS start_image(EFI_HANDLE image_handle, CHAR16 *ImagePath) int datasize = 0; efi_status = read_image(image_handle, ImagePath, &PathName, &data, - &datasize); + &datasize, 0); if (EFI_ERROR(efi_status)) goto done; @@ -1435,7 +1438,8 @@ load_revocations_file(EFI_HANDLE image_handle, CHAR16 *PathName) uint8_t *sspv_latest = NULL; efi_status = read_image(image_handle, L"revocations.efi", &PathName, - &data, &datasize); + &data, &datasize, + SUPPRESS_NETBOOT_OPEN_FAILURE_NOISE); if (EFI_ERROR(efi_status)) return efi_status; @@ -1499,7 +1503,8 @@ load_cert_file(EFI_HANDLE image_handle, CHAR16 *filename, CHAR16 *PathName) int i; efi_status = read_image(image_handle, filename, &PathName, - &data, &datasize); + &data, &datasize, + SUPPRESS_NETBOOT_OPEN_FAILURE_NOISE); if (EFI_ERROR(efi_status)) return efi_status; |
