mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-30 00:21:06 +00:00
Patch queue for efi v2019.01 - 2018-12-27
Three tiny last minute bug fixes: - Fix RTS relocation - Avoid read after free - Fix RTS data positioning (affects BBB) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABAgAGBQJcJIyVAAoJECszeR4D/txga28P/ibTdlp5RXNks9wbPudyJ376 yQV43yCySCd0z7QmlYzA7rBFMkk5XRog90ztDMkeorpx8P9bchx0X/ExirNflw1n LiHFQTey/esqmslYhhVZ5PpuuI32JiEv8IgxOprwvwjCqWujP4bS99FSiKaMH8EN Th9KyMY68FJSHaefulCHqCoEJANXllelLE+1+C9hL/5g89aRpitOpxJCreQHmUMA wV0xZwMwCn7T9kROnkZi8r7j5OKGvpmyDLetmEFBDy3wVGBGjP/4YgPdJr352T/U 6ujAE2enq1PEm7qPSBcXeRn1oAFYD3uTGiWopY6o5ew7fvJAUUi505ROAs5Gx0Mz b4CDWsHXvJF7hwzePOE6ZaJc3XL9zBTCi/6KYb8SQahANwIJ5RiD9Ydj1mJYuasA /JU2heQhcinwlOF2FhraJk0p73e/wlKeKGnFTvAEe4bAyKEgojt34cMpOf3TvMlo p34VlgByXiujtRy4rLa+GxbcPDDyIjvWGvkMU8g8lyLWG2qGJzVdUJUsf4IfL3oa FlbWgahSrbLpHs4FxF1ergtMI9hbD4mY3zsJmcu37BJ/wRk8ahfZ1SpubNTMzvEP exaw+WwZeWJgeEWuQWPhbqftNKdCWsSuGl75knZnWkZL7NBJihKYWAaiXMES+hLH jijMKR+ENUqAdKx19b4h =Z7dT -----END PGP SIGNATURE----- Merge tag 'signed-efi-2019.01' of git://github.com/agraf/u-boot Patch queue for efi v2019.01 - 2018-12-27 Three tiny last minute bug fixes: - Fix RTS relocation - Avoid read after free - Fix RTS data positioning (affects BBB)
This commit is contained in:
commit
bea3d82620
3 changed files with 38 additions and 9 deletions
|
@ -65,7 +65,8 @@ static void __efi_runtime make_crc_table(void)
|
|||
int n, k;
|
||||
uLong poly; /* polynomial exclusive-or pattern */
|
||||
/* terms of polynomial defining this crc (except x^32): */
|
||||
static const Byte p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
|
||||
static Byte __efi_runtime_data p[] = {
|
||||
0, 1, 2, 4, 5, 7, 8, 10, 11, 12, 16, 22, 23, 26};
|
||||
|
||||
/* make exclusive-or pattern from polynomial (0xedb88320L) */
|
||||
poly = 0L;
|
||||
|
|
|
@ -436,14 +436,42 @@ static efi_status_t EFIAPI efi_set_virtual_address_map(
|
|||
uint32_t descriptor_version,
|
||||
struct efi_mem_desc *virtmap)
|
||||
{
|
||||
ulong runtime_start = (ulong)&__efi_runtime_start &
|
||||
~(ulong)EFI_PAGE_MASK;
|
||||
int n = memory_map_size / descriptor_size;
|
||||
int i;
|
||||
int rt_code_sections = 0;
|
||||
|
||||
EFI_ENTRY("%lx %lx %x %p", memory_map_size, descriptor_size,
|
||||
descriptor_version, virtmap);
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
* Further down we are cheating. While really we should implement
|
||||
* SetVirtualAddressMap() events and ConvertPointer() to allow
|
||||
* dynamically loaded drivers to expose runtime services, we don't
|
||||
* today.
|
||||
*
|
||||
* So let's ensure we see exactly one single runtime section, as
|
||||
* that is the built-in one. If we see more (or less), someone must
|
||||
* have tried adding or removing to that which we don't support yet.
|
||||
* In that case, let's better fail rather than expose broken runtime
|
||||
* services.
|
||||
*/
|
||||
for (i = 0; i < n; i++) {
|
||||
struct efi_mem_desc *map = (void*)virtmap +
|
||||
(descriptor_size * i);
|
||||
|
||||
if (map->type == EFI_RUNTIME_SERVICES_CODE)
|
||||
rt_code_sections++;
|
||||
}
|
||||
|
||||
if (rt_code_sections != 1) {
|
||||
/*
|
||||
* We expose exactly one single runtime code section, so
|
||||
* something is definitely going wrong.
|
||||
*/
|
||||
return EFI_EXIT(EFI_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
/* Rebind mmio pointers */
|
||||
for (i = 0; i < n; i++) {
|
||||
struct efi_mem_desc *map = (void*)virtmap +
|
||||
|
@ -483,7 +511,7 @@ static efi_status_t EFIAPI efi_set_virtual_address_map(
|
|||
map = (void*)virtmap + (descriptor_size * i);
|
||||
if (map->type == EFI_RUNTIME_SERVICES_CODE) {
|
||||
ulong new_offset = map->virtual_start -
|
||||
(runtime_start - gd->relocaddr);
|
||||
map->physical_start + gd->relocaddr;
|
||||
|
||||
efi_runtime_relocate(new_offset, map);
|
||||
/* Once we're virtual, we can no longer handle
|
||||
|
|
|
@ -445,11 +445,6 @@ static int execute(void)
|
|||
efi_st_error("Failed to write file\n");
|
||||
return EFI_ST_FAILURE;
|
||||
}
|
||||
ret = file->close(file);
|
||||
if (ret != EFI_SUCCESS) {
|
||||
efi_st_error("Failed to close file\n");
|
||||
return EFI_ST_FAILURE;
|
||||
}
|
||||
ret = file->getpos(file, &pos);
|
||||
if (ret != EFI_SUCCESS) {
|
||||
efi_st_error("GetPosition failed\n");
|
||||
|
@ -460,6 +455,11 @@ static int execute(void)
|
|||
(unsigned int)pos);
|
||||
return EFI_ST_FAILURE;
|
||||
}
|
||||
ret = file->close(file);
|
||||
if (ret != EFI_SUCCESS) {
|
||||
efi_st_error("Failed to close file\n");
|
||||
return EFI_ST_FAILURE;
|
||||
}
|
||||
|
||||
/* Verify file */
|
||||
boottime->set_mem(buf, sizeof(buf), 0);
|
||||
|
|
Loading…
Reference in a new issue