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]
Date:	Mon, 11 Nov 2013 19:15:58 -0700
From:	Jerry Hoemann <jerry.hoemann@...com>
To:	rob@...dley.net, tglx@...utronix.de, mingo@...hat.com,
	hpa@...or.com, x86@...nel.org, matt.fleming@...el.com,
	yinghai@...nel.org, penberg@...nel.org, akpm@...ux-foundation.org,
	linux-doc@...r.kernel.org, linux-efi@...r.kernel.org,
	vgoyal@...hat.com
Cc:	linux-kernel@...r.kernel.org, jerry.hoemann@...com
Subject: [PATCH 3/3] x86, efi: Early use of boot service memory

Extend the kernel parameter add_efi_memmap to have additional
optional arguement "correct."   EFI memmaps that are "correct"
aren't accessed by platform firmware after a call to Exit Boot
Services.

Signed-off-by: Jerry Hoemann <jerry.hoemann@...com>
---
 Documentation/kernel-parameters.txt |  8 ++++++++
 arch/x86/platform/efi/efi.c         | 13 +++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index fcbb736..ae1bde6 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -346,6 +346,14 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 	add_efi_memmap	[EFI; X86] Include EFI memory map in
 			kernel's map of available physical RAM.
 
+	add_efi_memmap=	[EFI; X86] Include EFI memory map in
+			kernel's map of available physical RAM.
+			Additional Modifies:
+
+			correct: Platform firmware correctly doesn't reuse
+			boot service code or data segments after Exit Boot
+			Services.
+
 	agp=		[AGP]
 			{ off | try_unsupported }
 			off: disable AGP support
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index c7e22ab..0cb1cce 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -103,6 +103,10 @@ EXPORT_SYMBOL(add_efi_memmap);
 static int __init setup_add_efi_memmap(char *arg)
 {
 	add_efi_memmap = 1;
+	if (arg && strstr(arg, "correct")) {
+		pr_info("%s: setting EFI_MEMMAP_CORRECT\n", __func__);
+		set_bit(EFI_MEMMAP_CORRECT, &x86_efi_facility);
+	}
 	return 0;
 }
 early_param("add_efi_memmap", setup_add_efi_memmap);
@@ -422,6 +426,8 @@ static void __init print_efi_memmap(void)
 }
 #endif  /*  EFI_DEBUG  */
 
+static int	efi_boot_services_reservations;
+
 void __init efi_reserve_boot_services(void)
 {
 	void *p;
@@ -449,8 +455,10 @@ void __init efi_reserve_boot_services(void)
 			memblock_dbg("Could not reserve boot range "
 					"[0x%010llx-0x%010llx]\n",
 						start, start+size-1);
-		} else
+		} else {
 			memblock_reserve(start, size);
+			efi_boot_services_reservations++;
+		}
 	}
 }
 
@@ -467,7 +475,7 @@ void __init efi_free_boot_services(void)
 {
 	void *p;
 
-	if (!efi_is_native())
+	if (!efi_is_native() || !efi_boot_services_reservations)
 		return;
 
 	for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
@@ -484,6 +492,7 @@ void __init efi_free_boot_services(void)
 			continue;
 
 		free_bootmem_late(start, size);
+		efi_boot_services_reservations--;
 	}
 
 	efi_unmap_memmap();
-- 
1.7.11.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ