lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160630144143.GA13005@cloud>
Date:	Thu, 30 Jun 2016 07:41:43 -0700
From:	Josh Triplett <josh@...htriplett.org>
To:	Matt Fleming <matt@...eblueprint.co.uk>
Cc:	Ard Biesheuvel <ard.biesheuvel@...aro.org>,
	Dave Young <dyoung@...hat.com>, linux-kernel@...r.kernel.org,
	linux-efi@...r.kernel.org,
	Leif Lindholm <leif.lindholm@...aro.org>,
	Peter Jones <pjones@...hat.com>,
	Borislav Petkov <bp@...en8.de>,
	Mark Rutland <mark.rutland@....com>,
	Josh Boyer <jwboyer@...oraproject.org>,
	Andy Lutomirski <luto@...capital.net>,
	Môshe van der Sterre <me@...he.nl>
Subject: Re: [PATCH 11/11] x86/efi-bgrt: Use efi_mem_reserve() to avoid
 copying image data

On Thu, Jun 23, 2016 at 12:34:50PM +0100, Matt Fleming wrote:
> efi_mem_reserve() allows us to permanently mark EFI boot services
> regions as reserved, which means we no longer need to copy the image
> data out and into a separate buffer.
> 
> Leaving the data in the original boot services region has the added
> benefit that BGRT images can now be passed across kexec reboot.
> 
> Cc: Ard Biesheuvel <ard.biesheuvel@...aro.org>
> Cc: Leif Lindholm <leif.lindholm@...aro.org>
> Cc: Peter Jones <pjones@...hat.com>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: Mark Rutland <mark.rutland@....com>
> Cc: Dave Young <dyoung@...hat.com>
> Cc: Josh Boyer <jwboyer@...oraproject.org>
> Cc: Josh Triplett <josh@...htriplett.org>
> Cc: Andy Lutomirski <luto@...capital.net>
> Cc: Môshe van der Sterre <me@...he.nl>
> Signed-off-by: Matt Fleming <matt@...eblueprint.co.uk>

Reviewed-by: Josh Triplett <josh@...htriplett.org>

This definitely seems like an improvement.

>  arch/x86/platform/efi/efi-bgrt.c | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
> index 6a2f5691b1ab..6aad870e8962 100644
> --- a/arch/x86/platform/efi/efi-bgrt.c
> +++ b/arch/x86/platform/efi/efi-bgrt.c
> @@ -82,21 +82,12 @@ void __init efi_bgrt_init(void)
>  	}
>  	bgrt_image_size = bmp_header.size;
>  
> -	bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN);
> +	bgrt_image = memremap(bgrt_tab->image_address, bmp_header.size, MEMREMAP_WB);
>  	if (!bgrt_image) {
> -		pr_notice("Ignoring BGRT: failed to allocate memory for image (wanted %zu bytes)\n",
> -		       bgrt_image_size);
> -		return;
> -	}
> -
> -	image = memremap(bgrt_tab->image_address, bmp_header.size, MEMREMAP_WB);
> -	if (!image) {
>  		pr_notice("Ignoring BGRT: failed to map image memory\n");
> -		kfree(bgrt_image);
>  		bgrt_image = NULL;
>  		return;
>  	}
>  
> -	memcpy(bgrt_image, image, bgrt_image_size);
> -	memunmap(image);
> +	efi_mem_reserve(bgrt_tab->image_address, bgrt_image_size);
>  }
> -- 
> 2.7.3
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ