linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/mm/init_32: Don't print out kernel memory layout if KASLR
@ 2020-02-26 21:50 Arvind Sankar
  2020-02-29 23:51 ` Kees Cook
  0 siblings, 1 reply; 35+ messages in thread
From: Arvind Sankar @ 2020-02-26 21:50 UTC (permalink / raw)
  To: Tobin C . Harding, Tycho Andersen
  Cc: kernel-hardening, Dave Hansen, Andy Lutomirski, Peter Zijlstra,
	x86, linux-kernel

For security, only show the virtual kernel memory layout if KASLR is
disabled.

Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
---
 arch/x86/mm/init_32.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 23df4885bbed..53635be69102 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -788,6 +788,10 @@ void __init mem_init(void)
 	x86_init.hyper.init_after_bootmem();
 
 	mem_init_print_info(NULL);
+
+	if (kaslr_enabled())
+		goto skip_layout;
+
 	printk(KERN_INFO "virtual kernel memory layout:\n"
 		"    fixmap  : 0x%08lx - 0x%08lx   (%4ld kB)\n"
 		"  cpu_entry : 0x%08lx - 0x%08lx   (%4ld kB)\n"
@@ -827,6 +831,7 @@ void __init mem_init(void)
 		(unsigned long)&_text, (unsigned long)&_etext,
 		((unsigned long)&_etext - (unsigned long)&_text) >> 10);
 
+skip_layout:
 	/*
 	 * Check boundaries twice: Some fundamental inconsistencies can
 	 * be detected at build time already.
-- 
2.24.1


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

end of thread, other threads:[~2022-03-09 19:35 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-26 21:50 [PATCH] x86/mm/init_32: Don't print out kernel memory layout if KASLR Arvind Sankar
2020-02-29 23:51 ` Kees Cook
2020-03-01  0:11   ` Arvind Sankar
2020-03-02 18:38     ` Kees Cook
2020-03-05 15:05       ` [PATCH] microblaze: Stop printing the virtual memory layout Arvind Sankar
2020-03-05 20:50         ` Tycho Andersen
2020-03-09 10:09         ` Michal Simek
2020-03-05 15:06       ` [PATCH] nds32/mm: " Arvind Sankar
2020-03-05 20:50         ` Tycho Andersen
2020-03-05 15:08       ` [PATCH] powerpc/32: " Arvind Sankar
2020-03-05 20:50         ` Tycho Andersen
2022-03-09 19:35         ` Christophe Leroy
2020-03-05 15:10       ` [PATCH] sh: " Arvind Sankar
2020-03-05 15:18         ` John Paul Adrian Glaubitz
2020-03-05 15:38           ` Joe Perches
2020-03-05 15:41             ` John Paul Adrian Glaubitz
2020-03-05 15:46               ` Arvind Sankar
2020-03-05 15:49                 ` John Paul Adrian Glaubitz
2020-03-05 15:56                   ` Arvind Sankar
2020-03-05 20:51                     ` Tycho Andersen
2020-03-05 20:56                       ` John Paul Adrian Glaubitz
2020-03-05 21:17                       ` Kees Cook
2020-03-05 17:34                 ` Kees Cook
2020-03-06  8:04           ` Geert Uytterhoeven
2020-03-08 12:17           ` Kaiwan N Billimoria
2020-03-05 15:11       ` [PATCH] xtensa/mm: " Arvind Sankar
2020-03-05 20:51         ` Tycho Andersen
2020-03-06  7:54         ` Max Filippov
2020-03-01  0:22   ` [PATCH v2] x86/mm/init_32: " Arvind Sankar
2020-03-02 15:29     ` Tycho Andersen
2020-03-02 18:39     ` Kees Cook
2020-03-05 15:01       ` [PATCH v3] " Arvind Sankar
2020-03-05 17:28         ` Kees Cook
2020-03-05 20:49         ` Tycho Andersen
2020-03-05 23:00         ` [tip: x86/mm] x86/mm/init/32: " tip-bot2 for Arvind Sankar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).