diff options
author | Tom Rini <trini@konsulko.com> | 2021-02-14 09:27:46 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-02-14 09:27:46 -0500 |
commit | a6ba59583abd4085db5ab00358d751f175e2a451 (patch) | |
tree | ea047196d0b01763798a90b3d1fc8f2364f109ad | |
parent | 7c82e12cc4e9e25d7c89fe15bfeec4e9b0bb2b4d (diff) | |
parent | fd434f47d4d008d41f4ee2fe5cb94791f780395c (diff) | |
download | u-boot-WIP/14Feb2021.zip u-boot-WIP/14Feb2021.tar.gz u-boot-WIP/14Feb2021.tar.bz2 |
Merge tag 'efi-2021-04-rc2-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efiWIP/14Feb2021
Pull request for UEFI sub-system for efi-2021-04-rc2-2
Bug fixes:
* fix stack smashing in UEFI capsule updates
* correct loading of UEFI binaries where Virtual size is not a
multiple of FileAlignment
* simplify detection of capsule files.
* buildman: use threading.is_alive() instead of removed method IsAlive()
-rw-r--r-- | lib/efi_loader/efi_capsule.c | 22 | ||||
-rw-r--r-- | lib/efi_loader/efi_image_loader.c | 2 | ||||
-rw-r--r-- | tools/buildman/builder.py | 2 |
3 files changed, 16 insertions, 10 deletions
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c index 0d5a7b6..b57f030 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -42,20 +42,28 @@ static struct efi_file_handle *bootdev_root; static __maybe_unused unsigned int get_last_capsule(void) { u16 value16[11]; /* "CapsuleXXXX": non-null-terminated */ - char value[11], *p; + char value[5]; efi_uintn_t size; unsigned long index = 0xffff; efi_status_t ret; + int i; size = sizeof(value16); ret = efi_get_variable_int(L"CapsuleLast", &efi_guid_capsule_report, NULL, &size, value16, NULL); - if (ret != EFI_SUCCESS || u16_strncmp(value16, L"Capsule", 7)) + if (ret != EFI_SUCCESS || size != 22 || + u16_strncmp(value16, L"Capsule", 7)) goto err; + for (i = 0; i < 4; ++i) { + u16 c = value16[i + 7]; - p = value; - utf16_utf8_strcpy(&p, value16); - strict_strtoul(&value[7], 16, &index); + if (!c || c > 0x7f) + goto err; + value[i] = c; + } + value[4] = 0; + if (strict_strtoul(value, 16, &index)) + index = 0xffff; err: return index; } @@ -753,9 +761,7 @@ static efi_status_t efi_capsule_scan_dir(u16 ***files, unsigned int *num) if (!tmp_size) break; - if (!(dirent->attribute & EFI_FILE_DIRECTORY) && - u16_strcmp(dirent->file_name, L".") && - u16_strcmp(dirent->file_name, L"..")) + if (!(dirent->attribute & EFI_FILE_DIRECTORY)) count++; } diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c index d4dd9e94..f53ef36 100644 --- a/lib/efi_loader/efi_image_loader.c +++ b/lib/efi_loader/efi_image_loader.c @@ -843,7 +843,7 @@ efi_status_t efi_load_pe(struct efi_loaded_image_obj *handle, sec->Misc.VirtualSize); memcpy(efi_reloc + sec->VirtualAddress, efi + sec->PointerToRawData, - sec->SizeOfRawData); + min(sec->Misc.VirtualSize, sec->SizeOfRawData)); } /* Run through relocations */ diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index c939468..6f6d759 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -1691,7 +1691,7 @@ class Builder: term = threading.Thread(target=self.queue.join) term.setDaemon(True) term.start() - while term.isAlive(): + while term.is_alive(): term.join(100) # Wait until we have processed all output |