From mboxrd@z Thu Jan 1 00:00:00 1970 From: Borislav Petkov Subject: Re: [PATCH 3/3] efi: Make efi virtual runtime map passing more robust Date: Tue, 17 Dec 2013 12:23:34 +0100 Message-ID: <20131217112334.GB30592@pd.tnic> References: <1387236997-26975-1-git-send-email-bp@alien8.de> <1387236997-26975-4-git-send-email-bp@alien8.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Return-path: Content-Disposition: inline In-Reply-To: <1387236997-26975-4-git-send-email-bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org> Sender: linux-efi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Linux EFI , X86 ML , LKML Cc: Borislav Petkov , Matt Fleming , Matthew Garrett , "H. Peter Anvin" , Dave Young , James Bottomley , Vivek Goyal , Toshi Kani , Arjan van de Ven List-Id: linux-efi@vger.kernel.org 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. --