From: Borislav Petkov <bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org>
To: Linux EFI <linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
X86 ML <x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Borislav Petkov <bp-l3A5Bk7waGM@public.gmane.org>,
Matt Fleming
<matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>,
Matthew Garrett <mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>,
"H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
Dave Young <dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
James Bottomley
<James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>,
Vivek Goyal <vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Toshi Kani <toshi.kani-VXdhtT5mjnY@public.gmane.org>,
Arjan van de Ven <arjan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Subject: Re: [PATCH 3/3] efi: Make efi virtual runtime map passing more robust
Date: Tue, 17 Dec 2013 12:23:34 +0100 [thread overview]
Message-ID: <20131217112334.GB30592@pd.tnic> (raw)
In-Reply-To: <1387236997-26975-4-git-send-email-bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.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.
--
WARNING: multiple messages have this Message-ID (diff)
From: Borislav Petkov <bp@alien8.de>
To: Linux EFI <linux-efi@vger.kernel.org>, X86 ML <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Cc: Borislav Petkov <bp@suse.de>,
Matt Fleming <matt@console-pimps.org>,
Matthew Garrett <mjg59@srcf.ucam.org>,
"H. Peter Anvin" <hpa@zytor.com>, Dave Young <dyoung@redhat.com>,
James Bottomley <James.Bottomley@HansenPartnership.com>,
Vivek Goyal <vgoyal@redhat.com>, Toshi Kani <toshi.kani@hp.com>,
Arjan van de Ven <arjan@linux.intel.com>
Subject: Re: [PATCH 3/3] efi: Make efi virtual runtime map passing more robust
Date: Tue, 17 Dec 2013 12:23:34 +0100 [thread overview]
Message-ID: <20131217112334.GB30592@pd.tnic> (raw)
In-Reply-To: <1387236997-26975-4-git-send-email-bp@alien8.de>
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.
--
next prev parent reply other threads:[~2013-12-17 11:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-16 23:36 [PATCH 0/3] EFI memmap fix Borislav Petkov
2013-12-16 23:36 ` Borislav Petkov
2013-12-16 23:36 ` [PATCH 1/3] x86, ptdump: Add the functionality to dump an arbitrary pagetable Borislav Petkov
[not found] ` <1387236997-26975-1-git-send-email-bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org>
2013-12-16 23:36 ` [PATCH 2/3] efi: Dump the EFI page table Borislav Petkov
2013-12-16 23:36 ` Borislav Petkov
2013-12-17 1:11 ` [PATCH 0/3] EFI memmap fix Toshi Kani
2013-12-17 1:11 ` Toshi Kani
2013-12-16 23:36 ` [PATCH 3/3] efi: Make efi virtual runtime map passing more robust Borislav Petkov
[not found] ` <1387236997-26975-4-git-send-email-bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org>
2013-12-17 11:23 ` Borislav Petkov [this message]
2013-12-17 11:23 ` Borislav Petkov
2013-12-17 12:10 ` Matt Fleming
2013-12-17 12:10 ` Matt Fleming
2013-12-17 13:40 ` Borislav Petkov
2013-12-17 13:51 ` Matt Fleming
[not found] ` <20131217135156.GC3145-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-12-17 14:28 ` Borislav Petkov
2013-12-17 14:28 ` Borislav Petkov
2013-12-18 9:07 ` Dave Young
[not found] ` <20131218090757.GA15594-je1gSBvt1TcFLmT5oZ11vB/sF2h8X+2i0E9HWUfgJXw@public.gmane.org>
2013-12-18 11:42 ` Borislav Petkov
2013-12-18 11:42 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131217112334.GB30592@pd.tnic \
--to=bp-gina5biwoiwzqb+pc5nmwq@public.gmane.org \
--cc=James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org \
--cc=arjan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=bp-l3A5Bk7waGM@public.gmane.org \
--cc=dyoung-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
--cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org \
--cc=mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org \
--cc=toshi.kani-VXdhtT5mjnY@public.gmane.org \
--cc=vgoyal-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.