Messages in this thread | | | Date | Tue, 17 Dec 2013 12:23:34 +0100 | From | Borislav Petkov <> | Subject | Re: [PATCH 3/3] efi: Make efi virtual runtime map passing more robust |
| |
On Tue, Dec 17, 2013 at 12:36:37AM +0100, Borislav Petkov wrote: > @@ -880,6 +906,19 @@ void __init efi_enter_virtual_mode(void) > > efi_dump_pagetable(); > > + /* > + * It can happen that the physical address of new_memmap lands in memory > + * which is not mapped in the EFI page table. Therefore we need to go > + * and ident-map those pages containing the map before calling > + * phys_efi_set_virtual_address_map(). > + */ > + if (kernel_map_pages_in_pgd(pgd, __pa(new_memmap), __pa(new_memmap), > + 1 << new_memmap_shift, _PAGE_NX)) { > + pr_err("Error ident-mapping new memmap (0x%lx)!\n", > + __pa(new_memmap)); > + goto err_out; > + } > + > status = phys_efi_set_virtual_address_map( > memmap.desc_size * count, > memmap.desc_size, > @@ -916,7 +955,7 @@ void __init efi_enter_virtual_mode(void) > if (efi_enabled(EFI_OLD_MEMMAP) && (__supported_pte_mask & _PAGE_NX)) > runtime_code_page_mkexec(); > > - kfree(new_memmap); > + __free_pages(new_memmap, new_memmap_shift);
Note to self: carve out the error path of populate_pgd() into a separate function and call it here to unmap the pages previously mapped above as we're freeing them here.
-- Regards/Gruss, Boris.
Sent from a fat crate under my desk. Formatting is fine. --
| |