For security, only show the virtual kernel memory layout if KASLR is
disabled.
Signed-off-by: Arvind Sankar <[email protected]>
---
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
Arvind Sankar said:
> For security, only show the virtual kernel memory layout if KASLR is
> disabled.
These have been entirely removed on other architectures, so let's
just do the same for ia32 and remove it unconditionally.
071929dbdd86 ("arm64: Stop printing the virtual memory layout")
1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
-Kees
--
Kees Cook
On Sat, Feb 29, 2020 at 03:51:45PM -0800, Kees Cook wrote:
> Arvind Sankar said:
> > For security, only show the virtual kernel memory layout if KASLR is
> > disabled.
>
> These have been entirely removed on other architectures, so let's
> just do the same for ia32 and remove it unconditionally.
>
> 071929dbdd86 ("arm64: Stop printing the virtual memory layout")
> 1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
> 31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
> fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
> adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
>
> -Kees
>
> --
> Kees Cook
microblaze (arch/microblaze/mm/init.c) and PPC32 (arch/powerpc/mm/mem.c)
appear to still print it out. I can't test those, but will resubmit
x86-32 with it removed.
For security, don't display the kernel's virtual memory layout.
Signed-off-by: Arvind Sankar <[email protected]>
---
arch/x86/mm/init_32.c | 38 --------------------------------------
1 file changed, 38 deletions(-)
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 23df4885bbed..8ae0272c1c51 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -788,44 +788,6 @@ void __init mem_init(void)
x86_init.hyper.init_after_bootmem();
mem_init_print_info(NULL);
- 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"
-#ifdef CONFIG_HIGHMEM
- " pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
-#endif
- " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
- " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n"
- " .init : 0x%08lx - 0x%08lx (%4ld kB)\n"
- " .data : 0x%08lx - 0x%08lx (%4ld kB)\n"
- " .text : 0x%08lx - 0x%08lx (%4ld kB)\n",
- FIXADDR_START, FIXADDR_TOP,
- (FIXADDR_TOP - FIXADDR_START) >> 10,
-
- CPU_ENTRY_AREA_BASE,
- CPU_ENTRY_AREA_BASE + CPU_ENTRY_AREA_MAP_SIZE,
- CPU_ENTRY_AREA_MAP_SIZE >> 10,
-
-#ifdef CONFIG_HIGHMEM
- PKMAP_BASE, PKMAP_BASE+LAST_PKMAP*PAGE_SIZE,
- (LAST_PKMAP*PAGE_SIZE) >> 10,
-#endif
-
- VMALLOC_START, VMALLOC_END,
- (VMALLOC_END - VMALLOC_START) >> 20,
-
- (unsigned long)__va(0), (unsigned long)high_memory,
- ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20,
-
- (unsigned long)&__init_begin, (unsigned long)&__init_end,
- ((unsigned long)&__init_end -
- (unsigned long)&__init_begin) >> 10,
-
- (unsigned long)&_etext, (unsigned long)&_edata,
- ((unsigned long)&_edata - (unsigned long)&_etext) >> 10,
-
- (unsigned long)&_text, (unsigned long)&_etext,
- ((unsigned long)&_etext - (unsigned long)&_text) >> 10);
/*
* Check boundaries twice: Some fundamental inconsistencies can
--
2.24.1
On Sat, Feb 29, 2020 at 07:22:09PM -0500, Arvind Sankar wrote:
> For security, don't display the kernel's virtual memory layout.
>
> Signed-off-by: Arvind Sankar <[email protected]>
Acked-by: Tycho Andersen <[email protected]>
On Sat, Feb 29, 2020 at 07:11:23PM -0500, Arvind Sankar wrote:
> On Sat, Feb 29, 2020 at 03:51:45PM -0800, Kees Cook wrote:
> > Arvind Sankar said:
> > > For security, only show the virtual kernel memory layout if KASLR is
> > > disabled.
> >
> > These have been entirely removed on other architectures, so let's
> > just do the same for ia32 and remove it unconditionally.
> >
> > 071929dbdd86 ("arm64: Stop printing the virtual memory layout")
> > 1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
> > 31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
> > fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
> > adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
> >
> > -Kees
> >
> > --
> > Kees Cook
>
> microblaze (arch/microblaze/mm/init.c) and PPC32 (arch/powerpc/mm/mem.c)
> appear to still print it out. I can't test those, but will resubmit
> x86-32 with it removed.
Might as well fix those up too. :)
--
Kees Cook
On Sat, Feb 29, 2020 at 07:22:09PM -0500, Arvind Sankar wrote:
> For security, don't display the kernel's virtual memory layout.
>
> Signed-off-by: Arvind Sankar <[email protected]>
If this needs a v3, I'd just list the commits I mentioned for further
justification. But regardless:
Acked-by: Kees Cook <[email protected]>
-Kees
> ---
> arch/x86/mm/init_32.c | 38 --------------------------------------
> 1 file changed, 38 deletions(-)
>
> diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
> index 23df4885bbed..8ae0272c1c51 100644
> --- a/arch/x86/mm/init_32.c
> +++ b/arch/x86/mm/init_32.c
> @@ -788,44 +788,6 @@ void __init mem_init(void)
> x86_init.hyper.init_after_bootmem();
>
> mem_init_print_info(NULL);
> - 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"
> -#ifdef CONFIG_HIGHMEM
> - " pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
> -#endif
> - " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
> - " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n"
> - " .init : 0x%08lx - 0x%08lx (%4ld kB)\n"
> - " .data : 0x%08lx - 0x%08lx (%4ld kB)\n"
> - " .text : 0x%08lx - 0x%08lx (%4ld kB)\n",
> - FIXADDR_START, FIXADDR_TOP,
> - (FIXADDR_TOP - FIXADDR_START) >> 10,
> -
> - CPU_ENTRY_AREA_BASE,
> - CPU_ENTRY_AREA_BASE + CPU_ENTRY_AREA_MAP_SIZE,
> - CPU_ENTRY_AREA_MAP_SIZE >> 10,
> -
> -#ifdef CONFIG_HIGHMEM
> - PKMAP_BASE, PKMAP_BASE+LAST_PKMAP*PAGE_SIZE,
> - (LAST_PKMAP*PAGE_SIZE) >> 10,
> -#endif
> -
> - VMALLOC_START, VMALLOC_END,
> - (VMALLOC_END - VMALLOC_START) >> 20,
> -
> - (unsigned long)__va(0), (unsigned long)high_memory,
> - ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20,
> -
> - (unsigned long)&__init_begin, (unsigned long)&__init_end,
> - ((unsigned long)&__init_end -
> - (unsigned long)&__init_begin) >> 10,
> -
> - (unsigned long)&_etext, (unsigned long)&_edata,
> - ((unsigned long)&_edata - (unsigned long)&_etext) >> 10,
> -
> - (unsigned long)&_text, (unsigned long)&_etext,
> - ((unsigned long)&_etext - (unsigned long)&_text) >> 10);
>
> /*
> * Check boundaries twice: Some fundamental inconsistencies can
> --
> 2.24.1
>
--
Kees Cook
For security, don't display the kernel's virtual memory layout.
Kees Cook points out:
"These have been entirely removed on other architectures, so let's
just do the same for ia32 and remove it unconditionally."
071929dbdd86 ("arm64: Stop printing the virtual memory layout")
1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
Signed-off-by: Arvind Sankar <[email protected]>
---
arch/x86/mm/init_32.c | 38 --------------------------------------
1 file changed, 38 deletions(-)
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 23df4885bbed..8ae0272c1c51 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -788,44 +788,6 @@ void __init mem_init(void)
x86_init.hyper.init_after_bootmem();
mem_init_print_info(NULL);
- 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"
-#ifdef CONFIG_HIGHMEM
- " pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
-#endif
- " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
- " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n"
- " .init : 0x%08lx - 0x%08lx (%4ld kB)\n"
- " .data : 0x%08lx - 0x%08lx (%4ld kB)\n"
- " .text : 0x%08lx - 0x%08lx (%4ld kB)\n",
- FIXADDR_START, FIXADDR_TOP,
- (FIXADDR_TOP - FIXADDR_START) >> 10,
-
- CPU_ENTRY_AREA_BASE,
- CPU_ENTRY_AREA_BASE + CPU_ENTRY_AREA_MAP_SIZE,
- CPU_ENTRY_AREA_MAP_SIZE >> 10,
-
-#ifdef CONFIG_HIGHMEM
- PKMAP_BASE, PKMAP_BASE+LAST_PKMAP*PAGE_SIZE,
- (LAST_PKMAP*PAGE_SIZE) >> 10,
-#endif
-
- VMALLOC_START, VMALLOC_END,
- (VMALLOC_END - VMALLOC_START) >> 20,
-
- (unsigned long)__va(0), (unsigned long)high_memory,
- ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20,
-
- (unsigned long)&__init_begin, (unsigned long)&__init_end,
- ((unsigned long)&__init_end -
- (unsigned long)&__init_begin) >> 10,
-
- (unsigned long)&_etext, (unsigned long)&_edata,
- ((unsigned long)&_edata - (unsigned long)&_etext) >> 10,
-
- (unsigned long)&_text, (unsigned long)&_etext,
- ((unsigned long)&_etext - (unsigned long)&_text) >> 10);
/*
* Check boundaries twice: Some fundamental inconsistencies can
--
2.24.1
For security, don't display the kernel's virtual memory layout.
Kees Cook points out:
"These have been entirely removed on other architectures, so let's
just do the same for ia32 and remove it unconditionally."
071929dbdd86 ("arm64: Stop printing the virtual memory layout")
1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
Signed-off-by: Arvind Sankar <[email protected]>
---
arch/microblaze/mm/init.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index 1056f1674065..8323651bf7ec 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -201,18 +201,6 @@ void __init mem_init(void)
#endif
mem_init_print_info(NULL);
-#ifdef CONFIG_MMU
- pr_info("Kernel virtual memory layout:\n");
- pr_info(" * 0x%08lx..0x%08lx : fixmap\n", FIXADDR_START, FIXADDR_TOP);
-#ifdef CONFIG_HIGHMEM
- pr_info(" * 0x%08lx..0x%08lx : highmem PTEs\n",
- PKMAP_BASE, PKMAP_ADDR(LAST_PKMAP));
-#endif /* CONFIG_HIGHMEM */
- pr_info(" * 0x%08lx..0x%08lx : early ioremap\n",
- ioremap_bot, ioremap_base);
- pr_info(" * 0x%08lx..0x%08lx : vmalloc & ioremap\n",
- (unsigned long)VMALLOC_START, VMALLOC_END);
-#endif
mem_init_done = 1;
}
--
2.24.1
For security, don't display the kernel's virtual memory layout.
Kees Cook points out:
"These have been entirely removed on other architectures, so let's
just do the same for ia32 and remove it unconditionally."
071929dbdd86 ("arm64: Stop printing the virtual memory layout")
1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
Signed-off-by: Arvind Sankar <[email protected]>
---
arch/nds32/mm/init.c | 30 ------------------------------
1 file changed, 30 deletions(-)
diff --git a/arch/nds32/mm/init.c b/arch/nds32/mm/init.c
index 0be3833f6814..1c1e79b4407c 100644
--- a/arch/nds32/mm/init.c
+++ b/arch/nds32/mm/init.c
@@ -205,36 +205,6 @@ void __init mem_init(void)
memblock_free_all();
mem_init_print_info(NULL);
- pr_info("virtual kernel memory layout:\n"
- " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
-#ifdef CONFIG_HIGHMEM
- " pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
-#endif
- " consist : 0x%08lx - 0x%08lx (%4ld MB)\n"
- " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
- " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n"
- " .init : 0x%08lx - 0x%08lx (%4ld kB)\n"
- " .data : 0x%08lx - 0x%08lx (%4ld kB)\n"
- " .text : 0x%08lx - 0x%08lx (%4ld kB)\n",
- FIXADDR_START, FIXADDR_TOP, (FIXADDR_TOP - FIXADDR_START) >> 10,
-#ifdef CONFIG_HIGHMEM
- PKMAP_BASE, PKMAP_BASE + LAST_PKMAP * PAGE_SIZE,
- (LAST_PKMAP * PAGE_SIZE) >> 10,
-#endif
- CONSISTENT_BASE, CONSISTENT_END,
- ((CONSISTENT_END) - (CONSISTENT_BASE)) >> 20, VMALLOC_START,
- (unsigned long)VMALLOC_END, (VMALLOC_END - VMALLOC_START) >> 20,
- (unsigned long)__va(memory_start), (unsigned long)high_memory,
- ((unsigned long)high_memory -
- (unsigned long)__va(memory_start)) >> 20,
- (unsigned long)&__init_begin, (unsigned long)&__init_end,
- ((unsigned long)&__init_end -
- (unsigned long)&__init_begin) >> 10, (unsigned long)&_etext,
- (unsigned long)&_edata,
- ((unsigned long)&_edata - (unsigned long)&_etext) >> 10,
- (unsigned long)&_text, (unsigned long)&_etext,
- ((unsigned long)&_etext - (unsigned long)&_text) >> 10);
-
/*
* Check boundaries twice: Some fundamental inconsistencies can
* be detected at build time already.
--
2.24.1
For security, don't display the kernel's virtual memory layout.
Kees Cook points out:
"These have been entirely removed on other architectures, so let's
just do the same for ia32 and remove it unconditionally."
071929dbdd86 ("arm64: Stop printing the virtual memory layout")
1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
Signed-off-by: Arvind Sankar <[email protected]>
---
arch/powerpc/mm/mem.c | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index ef7b1119b2e2..df2c143b6bf7 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -331,23 +331,6 @@ void __init mem_init(void)
#endif
mem_init_print_info(NULL);
-#ifdef CONFIG_PPC32
- pr_info("Kernel virtual memory layout:\n");
-#ifdef CONFIG_KASAN
- pr_info(" * 0x%08lx..0x%08lx : kasan shadow mem\n",
- KASAN_SHADOW_START, KASAN_SHADOW_END);
-#endif
- pr_info(" * 0x%08lx..0x%08lx : fixmap\n", FIXADDR_START, FIXADDR_TOP);
-#ifdef CONFIG_HIGHMEM
- pr_info(" * 0x%08lx..0x%08lx : highmem PTEs\n",
- PKMAP_BASE, PKMAP_ADDR(LAST_PKMAP));
-#endif /* CONFIG_HIGHMEM */
- if (ioremap_bot != IOREMAP_TOP)
- pr_info(" * 0x%08lx..0x%08lx : early ioremap\n",
- ioremap_bot, IOREMAP_TOP);
- pr_info(" * 0x%08lx..0x%08lx : vmalloc & ioremap\n",
- VMALLOC_START, VMALLOC_END);
-#endif /* CONFIG_PPC32 */
}
void free_initmem(void)
--
2.24.1
For security, don't display the kernel's virtual memory layout.
Kees Cook points out:
"These have been entirely removed on other architectures, so let's
just do the same for ia32 and remove it unconditionally."
071929dbdd86 ("arm64: Stop printing the virtual memory layout")
1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
Signed-off-by: Arvind Sankar <[email protected]>
---
arch/sh/mm/init.c | 41 -----------------------------------------
1 file changed, 41 deletions(-)
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index d1b1ff2be17a..e68a1106e99b 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -360,47 +360,6 @@ void __init mem_init(void)
vsyscall_init();
mem_init_print_info(NULL);
- pr_info("virtual kernel memory layout:\n"
- " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
-#ifdef CONFIG_HIGHMEM
- " pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
-#endif
- " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
- " lowmem : 0x%08lx - 0x%08lx (%4ld MB) (cached)\n"
-#ifdef CONFIG_UNCACHED_MAPPING
- " : 0x%08lx - 0x%08lx (%4ld MB) (uncached)\n"
-#endif
- " .init : 0x%08lx - 0x%08lx (%4ld kB)\n"
- " .data : 0x%08lx - 0x%08lx (%4ld kB)\n"
- " .text : 0x%08lx - 0x%08lx (%4ld kB)\n",
- FIXADDR_START, FIXADDR_TOP,
- (FIXADDR_TOP - FIXADDR_START) >> 10,
-
-#ifdef CONFIG_HIGHMEM
- PKMAP_BASE, PKMAP_BASE+LAST_PKMAP*PAGE_SIZE,
- (LAST_PKMAP*PAGE_SIZE) >> 10,
-#endif
-
- (unsigned long)VMALLOC_START, VMALLOC_END,
- (VMALLOC_END - VMALLOC_START) >> 20,
-
- (unsigned long)memory_start, (unsigned long)high_memory,
- ((unsigned long)high_memory - (unsigned long)memory_start) >> 20,
-
-#ifdef CONFIG_UNCACHED_MAPPING
- uncached_start, uncached_end, uncached_size >> 20,
-#endif
-
- (unsigned long)&__init_begin, (unsigned long)&__init_end,
- ((unsigned long)&__init_end -
- (unsigned long)&__init_begin) >> 10,
-
- (unsigned long)&_etext, (unsigned long)&_edata,
- ((unsigned long)&_edata - (unsigned long)&_etext) >> 10,
-
- (unsigned long)&_text, (unsigned long)&_etext,
- ((unsigned long)&_etext - (unsigned long)&_text) >> 10);
-
mem_init_done = 1;
}
--
2.24.1
For security, don't display the kernel's virtual memory layout.
Kees Cook points out:
"These have been entirely removed on other architectures, so let's
just do the same for ia32 and remove it unconditionally."
071929dbdd86 ("arm64: Stop printing the virtual memory layout")
1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
Signed-off-by: Arvind Sankar <[email protected]>
---
arch/xtensa/mm/init.c | 46 -------------------------------------------
1 file changed, 46 deletions(-)
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index 19c625e6d81f..7ba3f1fce8ec 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -155,52 +155,6 @@ void __init mem_init(void)
memblock_free_all();
mem_init_print_info(NULL);
- pr_info("virtual kernel memory layout:\n"
-#ifdef CONFIG_KASAN
- " kasan : 0x%08lx - 0x%08lx (%5lu MB)\n"
-#endif
-#ifdef CONFIG_MMU
- " vmalloc : 0x%08lx - 0x%08lx (%5lu MB)\n"
-#endif
-#ifdef CONFIG_HIGHMEM
- " pkmap : 0x%08lx - 0x%08lx (%5lu kB)\n"
- " fixmap : 0x%08lx - 0x%08lx (%5lu kB)\n"
-#endif
- " lowmem : 0x%08lx - 0x%08lx (%5lu MB)\n"
- " .text : 0x%08lx - 0x%08lx (%5lu kB)\n"
- " .rodata : 0x%08lx - 0x%08lx (%5lu kB)\n"
- " .data : 0x%08lx - 0x%08lx (%5lu kB)\n"
- " .init : 0x%08lx - 0x%08lx (%5lu kB)\n"
- " .bss : 0x%08lx - 0x%08lx (%5lu kB)\n",
-#ifdef CONFIG_KASAN
- KASAN_SHADOW_START, KASAN_SHADOW_START + KASAN_SHADOW_SIZE,
- KASAN_SHADOW_SIZE >> 20,
-#endif
-#ifdef CONFIG_MMU
- VMALLOC_START, VMALLOC_END,
- (VMALLOC_END - VMALLOC_START) >> 20,
-#ifdef CONFIG_HIGHMEM
- PKMAP_BASE, PKMAP_BASE + LAST_PKMAP * PAGE_SIZE,
- (LAST_PKMAP*PAGE_SIZE) >> 10,
- FIXADDR_START, FIXADDR_TOP,
- (FIXADDR_TOP - FIXADDR_START) >> 10,
-#endif
- PAGE_OFFSET, PAGE_OFFSET +
- (max_low_pfn - min_low_pfn) * PAGE_SIZE,
-#else
- min_low_pfn * PAGE_SIZE, max_low_pfn * PAGE_SIZE,
-#endif
- ((max_low_pfn - min_low_pfn) * PAGE_SIZE) >> 20,
- (unsigned long)_text, (unsigned long)_etext,
- (unsigned long)(_etext - _text) >> 10,
- (unsigned long)__start_rodata, (unsigned long)__end_rodata,
- (unsigned long)(__end_rodata - __start_rodata) >> 10,
- (unsigned long)_sdata, (unsigned long)_edata,
- (unsigned long)(_edata - _sdata) >> 10,
- (unsigned long)__init_begin, (unsigned long)__init_end,
- (unsigned long)(__init_end - __init_begin) >> 10,
- (unsigned long)__bss_start, (unsigned long)__bss_stop,
- (unsigned long)(__bss_stop - __bss_start) >> 10);
}
static void __init parse_memmap_one(char *p)
--
2.24.1
On 3/5/20 4:10 PM, Arvind Sankar wrote:
> For security, don't display the kernel's virtual memory layout.
>
> Kees Cook points out:
> "These have been entirely removed on other architectures, so let's
> just do the same for ia32 and remove it unconditionally."
>
> 071929dbdd86 ("arm64: Stop printing the virtual memory layout")
> 1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
> 31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
> fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
> adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
Aww, why wasn't this made configurable? I found these memory map printouts
very useful for development.
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer - [email protected]
`. `' Freie Universitaet Berlin - [email protected]
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
On Thu, 2020-03-05 at 16:18 +0100, John Paul Adrian Glaubitz wrote:
> On 3/5/20 4:10 PM, Arvind Sankar wrote:
> > For security, don't display the kernel's virtual memory layout.
> >
> > Kees Cook points out:
> > "These have been entirely removed on other architectures, so let's
> > just do the same for ia32 and remove it unconditionally."
> >
> > 071929dbdd86 ("arm64: Stop printing the virtual memory layout")
> > 1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
> > 31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
> > fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
> > adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
> Aww, why wasn't this made configurable? I found these memory map printouts
> very useful for development.
It could be changed from pr_info to pr_devel.
A #define DEBUG would have to be added to emit it.
On 3/5/20 4:38 PM, Joe Perches wrote:
>> Aww, why wasn't this made configurable? I found these memory map printouts
>> very useful for development.
>
> It could be changed from pr_info to pr_devel.
>
> A #define DEBUG would have to be added to emit it.
Well, from the discussion it seems the decision to cut it out has already been
made, so I guess it's too late :(.
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer - [email protected]
`. `' Freie Universitaet Berlin - [email protected]
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
On Thu, Mar 05, 2020 at 04:41:05PM +0100, John Paul Adrian Glaubitz wrote:
> On 3/5/20 4:38 PM, Joe Perches wrote:
> >> Aww, why wasn't this made configurable? I found these memory map printouts
> >> very useful for development.
> >
> > It could be changed from pr_info to pr_devel.
> >
> > A #define DEBUG would have to be added to emit it.
>
> Well, from the discussion it seems the decision to cut it out has already been
> made, so I guess it's too late :(.
>
> Adrian
>
> --
> .''`. John Paul Adrian Glaubitz
> : :' : Debian Developer - [email protected]
> `. `' Freie Universitaet Berlin - [email protected]
> `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Not really too late. I can do s/pr_info/pr_devel and resubmit.
parisc for eg actually hides this in #if 0 rather than deleting the
code.
Kees, you fine with that?
On 3/5/20 4:46 PM, Arvind Sankar wrote:
> Not really too late. I can do s/pr_info/pr_devel and resubmit.
>
> parisc for eg actually hides this in #if 0 rather than deleting the
> code.
>
> Kees, you fine with that?
But wasn't it removed for all the other architectures already? Or are these
changes not in Linus' tree yet?
Adrian
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer - [email protected]
`. `' Freie Universitaet Berlin - [email protected]
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
On Thu, Mar 05, 2020 at 04:49:22PM +0100, John Paul Adrian Glaubitz wrote:
> On 3/5/20 4:46 PM, Arvind Sankar wrote:
> > Not really too late. I can do s/pr_info/pr_devel and resubmit.
> >
> > parisc for eg actually hides this in #if 0 rather than deleting the
> > code.
> >
> > Kees, you fine with that?
>
> But wasn't it removed for all the other architectures already? Or are these
> changes not in Linus' tree yet?
>
> Adrian
The ones mentioned in the commit message, yes, those are long gone. But
I don't see any reason why the remaining ones (there are 6 left that I
submitted patches just now for) couldn't switch to pr_devel instead.
On Thu, Mar 05, 2020 at 10:01:52AM -0500, Arvind Sankar wrote:
> For security, don't display the kernel's virtual memory layout.
>
> Kees Cook points out:
> "These have been entirely removed on other architectures, so let's
> just do the same for ia32 and remove it unconditionally."
>
> 071929dbdd86 ("arm64: Stop printing the virtual memory layout")
> 1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
> 31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
> fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
> adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
>
> Signed-off-by: Arvind Sankar <[email protected]>
Thanks!
(*randomly choosing an x86 maintainer to aim this patch at; hi Thomas!*)
Acked-by: Kees Cook <[email protected]>
-Kees
> ---
> arch/x86/mm/init_32.c | 38 --------------------------------------
> 1 file changed, 38 deletions(-)
>
> diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
> index 23df4885bbed..8ae0272c1c51 100644
> --- a/arch/x86/mm/init_32.c
> +++ b/arch/x86/mm/init_32.c
> @@ -788,44 +788,6 @@ void __init mem_init(void)
> x86_init.hyper.init_after_bootmem();
>
> mem_init_print_info(NULL);
> - 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"
> -#ifdef CONFIG_HIGHMEM
> - " pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
> -#endif
> - " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
> - " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n"
> - " .init : 0x%08lx - 0x%08lx (%4ld kB)\n"
> - " .data : 0x%08lx - 0x%08lx (%4ld kB)\n"
> - " .text : 0x%08lx - 0x%08lx (%4ld kB)\n",
> - FIXADDR_START, FIXADDR_TOP,
> - (FIXADDR_TOP - FIXADDR_START) >> 10,
> -
> - CPU_ENTRY_AREA_BASE,
> - CPU_ENTRY_AREA_BASE + CPU_ENTRY_AREA_MAP_SIZE,
> - CPU_ENTRY_AREA_MAP_SIZE >> 10,
> -
> -#ifdef CONFIG_HIGHMEM
> - PKMAP_BASE, PKMAP_BASE+LAST_PKMAP*PAGE_SIZE,
> - (LAST_PKMAP*PAGE_SIZE) >> 10,
> -#endif
> -
> - VMALLOC_START, VMALLOC_END,
> - (VMALLOC_END - VMALLOC_START) >> 20,
> -
> - (unsigned long)__va(0), (unsigned long)high_memory,
> - ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20,
> -
> - (unsigned long)&__init_begin, (unsigned long)&__init_end,
> - ((unsigned long)&__init_end -
> - (unsigned long)&__init_begin) >> 10,
> -
> - (unsigned long)&_etext, (unsigned long)&_edata,
> - ((unsigned long)&_edata - (unsigned long)&_etext) >> 10,
> -
> - (unsigned long)&_text, (unsigned long)&_etext,
> - ((unsigned long)&_etext - (unsigned long)&_text) >> 10);
>
> /*
> * Check boundaries twice: Some fundamental inconsistencies can
> --
> 2.24.1
>
--
Kees Cook
On Thu, Mar 05, 2020 at 10:46:58AM -0500, Arvind Sankar wrote:
> On Thu, Mar 05, 2020 at 04:41:05PM +0100, John Paul Adrian Glaubitz wrote:
> > On 3/5/20 4:38 PM, Joe Perches wrote:
> > >> Aww, why wasn't this made configurable? I found these memory map printouts
> > >> very useful for development.
> > >
> > > It could be changed from pr_info to pr_devel.
> > >
> > > A #define DEBUG would have to be added to emit it.
> >
> > Well, from the discussion it seems the decision to cut it out has already been
> > made, so I guess it's too late :(.
> >
> > Adrian
> >
> > --
> > .''`. John Paul Adrian Glaubitz
> > : :' : Debian Developer - [email protected]
> > `. `' Freie Universitaet Berlin - [email protected]
> > `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
>
> Not really too late. I can do s/pr_info/pr_devel and resubmit.
>
> parisc for eg actually hides this in #if 0 rather than deleting the
> code.
>
> Kees, you fine with that?
I don't mind pr_devel(). ("#if 0" tends to lead to code-rot since it's
not subjected to syntax checking in case the names of things change.)
That said, it's really up to the arch maintainers.
--
Kees Cook
On Thu, Mar 05, 2020 at 10:01:52AM -0500, Arvind Sankar wrote:
> For security, don't display the kernel's virtual memory layout.
>
> Kees Cook points out:
> "These have been entirely removed on other architectures, so let's
> just do the same for ia32 and remove it unconditionally."
>
> 071929dbdd86 ("arm64: Stop printing the virtual memory layout")
> 1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
> 31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
> fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
> adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
>
> Signed-off-by: Arvind Sankar <[email protected]>
Acked-by: Tycho Andersen <[email protected]>
On Thu, Mar 05, 2020 at 10:05:03AM -0500, Arvind Sankar wrote:
> For security, don't display the kernel's virtual memory layout.
>
> Kees Cook points out:
> "These have been entirely removed on other architectures, so let's
> just do the same for ia32 and remove it unconditionally."
>
> 071929dbdd86 ("arm64: Stop printing the virtual memory layout")
> 1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
> 31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
> fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
> adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
>
> Signed-off-by: Arvind Sankar <[email protected]>
Acked-by: Tycho Andersen <[email protected]>
On Thu, Mar 05, 2020 at 10:11:44AM -0500, Arvind Sankar wrote:
> For security, don't display the kernel's virtual memory layout.
>
> Kees Cook points out:
> "These have been entirely removed on other architectures, so let's
> just do the same for ia32 and remove it unconditionally."
>
> 071929dbdd86 ("arm64: Stop printing the virtual memory layout")
> 1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
> 31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
> fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
> adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
>
> Signed-off-by: Arvind Sankar <[email protected]>
Acked-by: Tycho Andersen <[email protected]>
On Thu, Mar 05, 2020 at 10:06:39AM -0500, Arvind Sankar wrote:
> For security, don't display the kernel's virtual memory layout.
>
> Kees Cook points out:
> "These have been entirely removed on other architectures, so let's
> just do the same for ia32 and remove it unconditionally."
>
> 071929dbdd86 ("arm64: Stop printing the virtual memory layout")
> 1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
> 31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
> fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
> adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
>
> Signed-off-by: Arvind Sankar <[email protected]>
Acked-by: Tycho Andersen <[email protected]>
On Thu, Mar 05, 2020 at 10:08:37AM -0500, Arvind Sankar wrote:
> For security, don't display the kernel's virtual memory layout.
>
> Kees Cook points out:
> "These have been entirely removed on other architectures, so let's
> just do the same for ia32 and remove it unconditionally."
>
> 071929dbdd86 ("arm64: Stop printing the virtual memory layout")
> 1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
> 31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
> fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
> adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
>
> Signed-off-by: Arvind Sankar <[email protected]>
Acked-by: Tycho Andersen <[email protected]>
On Thu, Mar 05, 2020 at 10:56:29AM -0500, Arvind Sankar wrote:
> On Thu, Mar 05, 2020 at 04:49:22PM +0100, John Paul Adrian Glaubitz wrote:
> > On 3/5/20 4:46 PM, Arvind Sankar wrote:
> > > Not really too late. I can do s/pr_info/pr_devel and resubmit.
> > >
> > > parisc for eg actually hides this in #if 0 rather than deleting the
> > > code.
> > >
> > > Kees, you fine with that?
> >
> > But wasn't it removed for all the other architectures already? Or are these
> > changes not in Linus' tree yet?
> >
> > Adrian
>
> The ones mentioned in the commit message, yes, those are long gone. But
> I don't see any reason why the remaining ones (there are 6 left that I
> submitted patches just now for) couldn't switch to pr_devel instead.
If you do happen to re-send with pr_debug() instead, feel free to add
my ack to that series as well. But in any case, this one is also:
Acked-by: Tycho Andersen <[email protected]>
> On Mar 5, 2020, at 9:52 PM, Tycho Andersen <[email protected]> wrote:
>
> On Thu, Mar 05, 2020 at 10:56:29AM -0500, Arvind Sankar wrote:
>>> On Thu, Mar 05, 2020 at 04:49:22PM +0100, John Paul Adrian Glaubitz wrote:
>>> On 3/5/20 4:46 PM, Arvind Sankar wrote:
>>>> Not really too late. I can do s/pr_info/pr_devel and resubmit.
>>>>
>>>> parisc for eg actually hides this in #if 0 rather than deleting the
>>>> code.
>>>>
>>>> Kees, you fine with that?
>>>
>>> But wasn't it removed for all the other architectures already? Or are these
>>> changes not in Linus' tree yet?
>>>
>>> Adrian
>>
>> The ones mentioned in the commit message, yes, those are long gone. But
>> I don't see any reason why the remaining ones (there are 6 left that I
>> submitted patches just now for) couldn't switch to pr_devel instead.
>
> If you do happen to re-send with pr_debug() instead, feel free to add
> my ack to that series as well.
Since it already got removed for most other architectures, I don’t think it makes much sense to keep it for consistency.
I just didn’t understand why it was made configurable for debugging purposes in the first place.
Also, many distributions disable access to the kernel buffer for unprivileged users anyway.
Adrian
On Thu, Mar 05, 2020 at 01:51:58PM -0700, Tycho Andersen wrote:
> On Thu, Mar 05, 2020 at 10:56:29AM -0500, Arvind Sankar wrote:
> > On Thu, Mar 05, 2020 at 04:49:22PM +0100, John Paul Adrian Glaubitz wrote:
> > > On 3/5/20 4:46 PM, Arvind Sankar wrote:
> > > > Not really too late. I can do s/pr_info/pr_devel and resubmit.
> > > >
> > > > parisc for eg actually hides this in #if 0 rather than deleting the
> > > > code.
> > > >
> > > > Kees, you fine with that?
> > >
> > > But wasn't it removed for all the other architectures already? Or are these
> > > changes not in Linus' tree yet?
> > >
> > > Adrian
> >
> > The ones mentioned in the commit message, yes, those are long gone. But
> > I don't see any reason why the remaining ones (there are 6 left that I
> > submitted patches just now for) couldn't switch to pr_devel instead.
>
> If you do happen to re-send with pr_debug() instead, feel free to add
(FYI, pr_devel() was suggested, not pr_debug() -- the former is
compile-time enabled with DEBUG and the latter can be enabled dynamically
in some cases in the kernel, so pr_debug() should not be used.)
> my ack to that series as well. But in any case, this one is also:
>
> Acked-by: Tycho Andersen <[email protected]>
Same for me. :) Consider the series:
Acked-by: Kees Cook <[email protected]>
--
Kees Cook
The following commit has been merged into the x86/mm branch of tip:
Commit-ID: 681ff0181bbfb183e32bc6beb6ec076304470479
Gitweb: https://git.kernel.org/tip/681ff0181bbfb183e32bc6beb6ec076304470479
Author: Arvind Sankar <[email protected]>
AuthorDate: Thu, 05 Mar 2020 10:01:52 -05:00
Committer: Thomas Gleixner <[email protected]>
CommitterDate: Thu, 05 Mar 2020 23:53:55 +01:00
x86/mm/init/32: Stop printing the virtual memory layout
For security reasons, don't display the kernel's virtual memory layout.
Kees Cook points out:
"These have been entirely removed on other architectures, so let's
just do the same for ia32 and remove it unconditionally."
071929dbdd86 ("arm64: Stop printing the virtual memory layout")
1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
Signed-off-by: Arvind Sankar <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Acked-by: Tycho Andersen <[email protected]>
Acked-by: Kees Cook <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
---
arch/x86/mm/init_32.c | 38 --------------------------------------
1 file changed, 38 deletions(-)
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 23df488..8ae0272 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -788,44 +788,6 @@ void __init mem_init(void)
x86_init.hyper.init_after_bootmem();
mem_init_print_info(NULL);
- 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"
-#ifdef CONFIG_HIGHMEM
- " pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
-#endif
- " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
- " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n"
- " .init : 0x%08lx - 0x%08lx (%4ld kB)\n"
- " .data : 0x%08lx - 0x%08lx (%4ld kB)\n"
- " .text : 0x%08lx - 0x%08lx (%4ld kB)\n",
- FIXADDR_START, FIXADDR_TOP,
- (FIXADDR_TOP - FIXADDR_START) >> 10,
-
- CPU_ENTRY_AREA_BASE,
- CPU_ENTRY_AREA_BASE + CPU_ENTRY_AREA_MAP_SIZE,
- CPU_ENTRY_AREA_MAP_SIZE >> 10,
-
-#ifdef CONFIG_HIGHMEM
- PKMAP_BASE, PKMAP_BASE+LAST_PKMAP*PAGE_SIZE,
- (LAST_PKMAP*PAGE_SIZE) >> 10,
-#endif
-
- VMALLOC_START, VMALLOC_END,
- (VMALLOC_END - VMALLOC_START) >> 20,
-
- (unsigned long)__va(0), (unsigned long)high_memory,
- ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20,
-
- (unsigned long)&__init_begin, (unsigned long)&__init_end,
- ((unsigned long)&__init_end -
- (unsigned long)&__init_begin) >> 10,
-
- (unsigned long)&_etext, (unsigned long)&_edata,
- ((unsigned long)&_edata - (unsigned long)&_etext) >> 10,
-
- (unsigned long)&_text, (unsigned long)&_etext,
- ((unsigned long)&_etext - (unsigned long)&_text) >> 10);
/*
* Check boundaries twice: Some fundamental inconsistencies can
On Thu, Mar 5, 2020 at 7:11 AM Arvind Sankar <[email protected]> wrote:
>
> For security, don't display the kernel's virtual memory layout.
Given that primary users of xtensa linux kernels are developers
removing this information, and even disabling it by default doesn't
sound reasonable to me.
--
Thanks.
-- Max
Hi Adrian,
On Thu, Mar 5, 2020 at 4:18 PM John Paul Adrian Glaubitz
<[email protected]> wrote:
> On 3/5/20 4:10 PM, Arvind Sankar wrote:
> > For security, don't display the kernel's virtual memory layout.
> >
> > Kees Cook points out:
> > "These have been entirely removed on other architectures, so let's
> > just do the same for ia32 and remove it unconditionally."
> >
> > 071929dbdd86 ("arm64: Stop printing the virtual memory layout")
> > 1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
> > 31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
> > fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
> > adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
> Aww, why wasn't this made configurable? I found these memory map printouts
> very useful for development.
In most of the above (but not in this patch), "%p" was used to print
addresses, which started showing useless hashed addresses since commit
ad67b74d2469d9b8 ("printk: hash addresses printed with %p").
Instead of changing them all to print usable addresses instead, it was
agreed upon to just remove them.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
On Thu, Mar 5, 2020 at 8:48 PM John Paul Adrian Glaubitz
<[email protected]> wrote:
>
> On 3/5/20 4:10 PM, Arvind Sankar wrote:
> > For security, don't display the kernel's virtual memory layout.
> >
> > Kees Cook points out:
> > "These have been entirely removed on other architectures, so let's
> > just do the same for ia32 and remove it unconditionally."
> >
> > 071929dbdd86 ("arm64: Stop printing the virtual memory layout")
> > 1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
> > 31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
> > fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
> > adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
> Aww, why wasn't this made configurable? I found these memory map printouts
> very useful for development.
Same here! IMO, the kernel segment layout is useful for devs/debug purposes.
Perhaps:
a) all these printk's could be gathered into one function and invoked
only when DEBUG (or equivalent) is defined?
b) else, the s/pr_info/pr_devel approach with %pK should be good?
-Kaiwan.
On 05. 03. 20 16:05, Arvind Sankar wrote:
> For security, don't display the kernel's virtual memory layout.
>
> Kees Cook points out:
> "These have been entirely removed on other architectures, so let's
> just do the same for ia32 and remove it unconditionally."
>
> 071929dbdd86 ("arm64: Stop printing the virtual memory layout")
> 1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
> 31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
> fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
> adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
>
> Signed-off-by: Arvind Sankar <[email protected]>
> ---
> arch/microblaze/mm/init.c | 12 ------------
> 1 file changed, 12 deletions(-)
>
> diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
> index 1056f1674065..8323651bf7ec 100644
> --- a/arch/microblaze/mm/init.c
> +++ b/arch/microblaze/mm/init.c
> @@ -201,18 +201,6 @@ void __init mem_init(void)
> #endif
>
> mem_init_print_info(NULL);
> -#ifdef CONFIG_MMU
> - pr_info("Kernel virtual memory layout:\n");
> - pr_info(" * 0x%08lx..0x%08lx : fixmap\n", FIXADDR_START, FIXADDR_TOP);
> -#ifdef CONFIG_HIGHMEM
> - pr_info(" * 0x%08lx..0x%08lx : highmem PTEs\n",
> - PKMAP_BASE, PKMAP_ADDR(LAST_PKMAP));
> -#endif /* CONFIG_HIGHMEM */
> - pr_info(" * 0x%08lx..0x%08lx : early ioremap\n",
> - ioremap_bot, ioremap_base);
> - pr_info(" * 0x%08lx..0x%08lx : vmalloc & ioremap\n",
> - (unsigned long)VMALLOC_START, VMALLOC_END);
> -#endif
> mem_init_done = 1;
> }
>
>
Applied.
M
--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: http://www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs
Le 05/03/2020 à 16:08, Arvind Sankar a écrit :
> For security, don't display the kernel's virtual memory layout.
>
> Kees Cook points out:
> "These have been entirely removed on other architectures, so let's
> just do the same for ia32 and remove it unconditionally."
>
> 071929dbdd86 ("arm64: Stop printing the virtual memory layout")
> 1c31d4e96b8c ("ARM: 8820/1: mm: Stop printing the virtual memory layout")
> 31833332f798 ("m68k/mm: Stop printing the virtual memory layout")
> fd8d0ca25631 ("parisc: Hide virtual kernel memory layout")
> adb1fe9ae2ee ("mm/page_alloc: Remove kernel address exposure in free_reserved_area()")
>
> Signed-off-by: Arvind Sankar <[email protected]>
This patch doesn't apply anymore.
This patch is referenced in https://github.com/linuxppc/issues/issues/390
> ---
> arch/powerpc/mm/mem.c | 17 -----------------
> 1 file changed, 17 deletions(-)
>
> diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
> index ef7b1119b2e2..df2c143b6bf7 100644
> --- a/arch/powerpc/mm/mem.c
> +++ b/arch/powerpc/mm/mem.c
> @@ -331,23 +331,6 @@ void __init mem_init(void)
> #endif
>
> mem_init_print_info(NULL);
> -#ifdef CONFIG_PPC32
> - pr_info("Kernel virtual memory layout:\n");
> -#ifdef CONFIG_KASAN
> - pr_info(" * 0x%08lx..0x%08lx : kasan shadow mem\n",
> - KASAN_SHADOW_START, KASAN_SHADOW_END);
> -#endif
> - pr_info(" * 0x%08lx..0x%08lx : fixmap\n", FIXADDR_START, FIXADDR_TOP);
> -#ifdef CONFIG_HIGHMEM
> - pr_info(" * 0x%08lx..0x%08lx : highmem PTEs\n",
> - PKMAP_BASE, PKMAP_ADDR(LAST_PKMAP));
> -#endif /* CONFIG_HIGHMEM */
> - if (ioremap_bot != IOREMAP_TOP)
> - pr_info(" * 0x%08lx..0x%08lx : early ioremap\n",
> - ioremap_bot, IOREMAP_TOP);
> - pr_info(" * 0x%08lx..0x%08lx : vmalloc & ioremap\n",
> - VMALLOC_START, VMALLOC_END);
> -#endif /* CONFIG_PPC32 */
> }
>
> void free_initmem(void)