History

efi/libstub: Allocate headspace in efi_get_memory_map()

efi_get_memory_map() allocates a buffer to store the memory map that it retrieves. This buffer may need to be reused by the client after ExitBootServices() is called, at which point allocations are not longer permitted. To support this usecase, provide the allocated buffer size back to the client, and allocate some additional headroom to account for any reasonable growth in the map that is likely to happen between the call to efi_get_memory_map() and the client reusing the buffer.

Jeffrey Hugo committed 10 years ago

Commit dadb57a1 parent 4af9ed55 files · +111 −49Browse files

Showing the changes to include/linux (1 of 5 files). Show all

Unified · Split

include/linux/efi.h+10−5
@@ -118,6 +118,15 @@ typedef struct { · 117 unmodified lines
118 u32 imagesize;118 u32 imagesize;
119} efi_capsule_header_t;119} efi_capsule_header_t;
120 120
121struct efi_boot_memmap {
122 efi_memory_desc_t **map;
123 unsigned long *map_size;
124 unsigned long *desc_size;
125 u32 *desc_ver;
126 unsigned long *key_ptr;
127 unsigned long *buff_size;
128};
129
121/*130/*
122 * EFI capsule flags131 * EFI capsule flags
123 */132 */
@@ -1371,11 +1380,7 @@ char *efi_convert_cmdline(efi_system_table_t *sys_table_arg, · 1247 unmodified lines
1371 efi_loaded_image_t *image, int *cmd_line_len);1380 efi_loaded_image_t *image, int *cmd_line_len);
1372 1381
1373efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg,1382efi_status_t efi_get_memory_map(efi_system_table_t *sys_table_arg,
1374 efi_memory_desc_t **map,1383 struct efi_boot_memmap *map);
1375 unsigned long *map_size,
1376 unsigned long *desc_size,
1377 u32 *desc_ver,
1378 unsigned long *key_ptr);
1379 1384
1380efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,1385efi_status_t efi_low_alloc(efi_system_table_t *sys_table_arg,
1381 unsigned long size, unsigned long align,1386 unsigned long size, unsigned long align,