public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] x86/boot: fix KASL when memmap range manipulation is used
@ 2019-01-30 16:40 Julian Stecklina
  2019-01-30 16:40 ` [PATCH 2/2] x86/boot: increase maximum number of avoided KASLR regions Julian Stecklina
  2019-02-11  9:09 ` [PATCH 1/2] x86/boot: fix KASL when memmap range manipulation is used Baoquan He
  0 siblings, 2 replies; 9+ messages in thread
From: Julian Stecklina @ 2019-01-30 16:40 UTC (permalink / raw)
  To: x86
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, hpa, linux-kernel,
	jschoenh, Julian Stecklina

From: Julian Stecklina <jsteckli@amazon.de>

When the user passes a memmap=<size>%<offset>-<oldtype>+<newtype>
parameter to the kernel to reclassify some memory, this information is
ignored during the randomization of the kernel base address. This in
turn leads to cases where the kernel is unpacked to memory regions that
the user marked as reserved.

Fix this situation to avoid any memory region for KASLR that is
reclassified.

Fixes: ef61f8a340fd6d49df6b367785743febc47320c1 ("x86/boot/e820: Implement a range manipulation operator")

Signed-off-by: Julian Stecklina <jsteckli@amazon.de>
---
 arch/x86/boot/compressed/kaslr.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 9ed9709..5657e34 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -155,6 +155,12 @@ parse_memmap(char *p, unsigned long long *start, unsigned long long *size)
 	case '#':
 	case '$':
 	case '!':
+		/*
+		 * % would need some more complex parsing, because regions might
+		 * actually become usable for KASLR, but the simple way of
+		 * ignoring anything that is mentioned in % works for now.
+		 */
+	case '%':
 		*start = memparse(p + 1, &p);
 		return 0;
 	case '@':
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-02-11  9:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-30 16:40 [PATCH 1/2] x86/boot: fix KASL when memmap range manipulation is used Julian Stecklina
2019-01-30 16:40 ` [PATCH 2/2] x86/boot: increase maximum number of avoided KASLR regions Julian Stecklina
2019-02-05 14:44   ` Borislav Petkov
2019-02-06 12:50     ` Julian Stecklina
2019-02-06 14:17       ` Borislav Petkov
2019-02-06 15:29         ` Kees Cook
2019-02-06 17:53           ` Borislav Petkov
2019-02-11  9:09 ` [PATCH 1/2] x86/boot: fix KASL when memmap range manipulation is used Baoquan He
2019-02-11  9:54   ` Julian Stecklina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox