public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matt Fleming <matt@console-pimps.org>
To: Borislav Petkov <bp@alien8.de>
Cc: Linux EFI <linux-efi@vger.kernel.org>, X86 ML <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>, Borislav Petkov <bp@suse.de>,
	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:10:24 +0000	[thread overview]
Message-ID: <20131217121024.GB3145@console-pimps.org> (raw)
In-Reply-To: <1387236997-26975-4-git-send-email-bp@alien8.de>

On Tue, 17 Dec, at 12:36:37AM, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
> 
> Currently, running SetVirtualAddressMap() and passing the physical
> address of the virtual map array was working only by a lucky coincidence
> because the memory was present in the EFI page table too. Until Toshi
> went and booted this on a big HP box - the krealloc() manner of resizing
> the memmap we're doing did allocate from such physical addresses which
> were not mapped anymore and boom:
> 
> http://lkml.kernel.org/r/1386806463.1791.295.camel@misato.fc.hp.com
> 
> One way to take care of that issue is to reimplement the krealloc thing
> but with pages. We start with contiguous pages of order 1, i.e. 2 pages,
> and when we deplete that memory (shouldn't happen all that often but you
> know firmware) we realloc the next power-of-two pages.
> 
> Having the pages, it is much more handy and easy to map them into the
> EFI page table with the already existing mapping code which we're using
> for building the virtual mappings.
> 
> And, it doesn't matter all that much how much pages we've used as we're
> freeing them right after they've fulfilled their purpose at the end of
> the function anyway.
> 
> Reported-by: Toshi Kani <toshi.kani@hp.com>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> ---
>  arch/x86/platform/efi/efi.c | 57 ++++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 48 insertions(+), 9 deletions(-)

[...]

> @@ -794,12 +814,13 @@ void __init old_map_region(efi_memory_desc_t *md)
>   */
>  void __init efi_enter_virtual_mode(void)
>  {
> +	pgd_t *pgd = (pgd_t *)__va(real_mode_header->trampoline_pgd);
> +	unsigned long size, new_memmap_left = 0;
>  	efi_memory_desc_t *md, *prev_md = NULL;
> +	int count = 0, new_memmap_shift = 0;
>  	void *p, *new_memmap = NULL;
> -	unsigned long size;
>  	efi_status_t status;
>  	u64 end, systab;
> -	int count = 0;
>  
>  	efi.systab = NULL;

You sunk my i386 battleship,

/home/build/git/efi/arch/x86/platform/efi/efi.c:824:24: error: ‘struct real_mode_header’ has no member named ‘trampoline_pgd’
make[4]: *** [arch/x86/platform/efi/efi.o] Error 1
make[3]: *** [arch/x86/platform/efi] Error 2

-- 
Matt Fleming, Intel Open Source Technology Center

  parent reply	other threads:[~2013-12-17 12:10 UTC|newest]

Thread overview: 12+ 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 ` [PATCH 1/3] x86, ptdump: Add the functionality to dump an arbitrary pagetable Borislav Petkov
2013-12-16 23:36 ` [PATCH 2/3] efi: Dump the EFI page table Borislav Petkov
2013-12-16 23:36 ` [PATCH 3/3] efi: Make efi virtual runtime map passing more robust Borislav Petkov
2013-12-17 11:23   ` Borislav Petkov
2013-12-17 12:10   ` Matt Fleming [this message]
2013-12-17 13:40     ` Borislav Petkov
2013-12-17 13:51       ` Matt Fleming
2013-12-17 14:28         ` Borislav Petkov
2013-12-18  9:07   ` Dave Young
2013-12-18 11:42     ` Borislav Petkov
2013-12-17  1:11 ` [PATCH 0/3] EFI memmap fix Toshi Kani

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=20131217121024.GB3145@console-pimps.org \
    --to=matt@console-pimps.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=arjan@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=bp@suse.de \
    --cc=dyoung@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=toshi.kani@hp.com \
    --cc=vgoyal@redhat.com \
    --cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox