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()
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmApIc4ACgkQxIHbvCwF
 GsRQpQ//Zk4eJAHeibV4whdjyWpVXEnRR1fMFDgD7WUq3jTZmUvNp99ME5UJv+6J
 9R3WHZGfYIS+SypEe1BhzaSOfeS8GPkuk6bkEeM8MRA5L5vAdnONmUAa5TGp+xaq
 0V//k9U7raeWD+pdo7WA3GA8wQ4BoOgbCVNJfePfO2bD3okJZOT4S5qjFWD7Thfj
 TgiN6L44he5MrY9rKF0ZJcijtKpKBbwf5AYSurafgEJJJWkaEDynt2H5aJiIJ67v
 8LiomMPmvke7owft7JxntScvxNfcKagFojtSB3zShJ7Fbx0EMJFyGHfdBQHNiqgA
 7GbQyhdk6FFlhlAwanTjxMfPfpLBjeTZhv5UtIpEDU8gv7PHEgVAT2NAQjcEbU6G
 TssHzaWvpA/fNlV/s7b+uoW4pyvuvbeCtdxj7WB8O+j7uW5Z6APzMAxJZJ6RoCx/
 GDtsvkUUKpLwpPXQwsi/+BS6FNZGqY/GnijZmFdQZkUieXVLqCmuyu83UKfa8jMH
 6Q9yjSH9jDEWe4xS3XwfLY49k6qeKNjOZbB1aYQPqZallfvXx9qOYzQi1HHSx6Z5
 FngAYj3c6lxHp0p726m2Vjgceg02O3AmMaVHOkIh4TpLoRzR2msJAgpOghNtAi49
 vV47rr0HpvhBwfgVuJ+uVf7lFDbondoX5t9OuptUFxmyEZH5b5o=
 =Na9Y
 -----END PGP SIGNATURE-----

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()
This commit is contained in:
Tom Rini 2021-02-14 09:27:46 -05:00
commit a6ba59583a
3 changed files with 16 additions and 10 deletions

View file

@ -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++;
}

View file

@ -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 */

View file

@ -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