提交 a6ba5958 编写于 作者: T Tom Rini

Merge tag 'efi-2021-04-rc2-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

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()
......@@ -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++;
}
......
......@@ -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 */
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册