linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] unicore32: Stop printing the virtual memory layout
@ 2018-08-28 14:23 Geert Uytterhoeven
  2018-08-28 14:30 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2018-08-28 14:23 UTC (permalink / raw)
  To: Guan Xuetao; +Cc: Kees Cook, linux-kernel, Geert Uytterhoeven

Since commit ad67b74d2469d9b8 ("printk: hash addresses printed with
%p"), the virtual memory layout printed during boot up contains "ptrval"
instead of actual addresses.

Instead of changing the printing to "%px", and leaking virtual memory
layout information again, just remove the printing completely, cfr. e.g.
commits 071929dbdd865f77 ("arm64: Stop printing the virtual memory
layout") and  31833332f7987636 ("m68k/mm: Stop printing the virtual
memory layout").

All interesting information (actual section sizes) is already printed by
mem_init_print_info() just above anyway.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/unicore32/mm/init.c | 24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/arch/unicore32/mm/init.c b/arch/unicore32/mm/init.c
index f4950fbfe57493c7..1662058c272a5917 100644
--- a/arch/unicore32/mm/init.c
+++ b/arch/unicore32/mm/init.c
@@ -344,30 +344,6 @@ void __init mem_init(void)
 	free_all_bootmem();
 
 	mem_init_print_info(NULL);
-	printk(KERN_NOTICE "Virtual kernel memory layout:\n"
-		"    vector  : 0x%08lx - 0x%08lx   (%4ld kB)\n"
-		"    vmalloc : 0x%08lx - 0x%08lx   (%4ld MB)\n"
-		"    lowmem  : 0x%08lx - 0x%08lx   (%4ld MB)\n"
-		"    modules : 0x%08lx - 0x%08lx   (%4ld MB)\n"
-		"      .init : 0x%p" " - 0x%p" "   (%4d kB)\n"
-		"      .text : 0x%p" " - 0x%p" "   (%4d kB)\n"
-		"      .data : 0x%p" " - 0x%p" "   (%4d kB)\n",
-
-		VECTORS_BASE, VECTORS_BASE + PAGE_SIZE,
-		DIV_ROUND_UP(PAGE_SIZE, SZ_1K),
-		VMALLOC_START, VMALLOC_END,
-		DIV_ROUND_UP((VMALLOC_END - VMALLOC_START), SZ_1M),
-		PAGE_OFFSET, (unsigned long)high_memory,
-		DIV_ROUND_UP(((unsigned long)high_memory - PAGE_OFFSET), SZ_1M),
-		MODULES_VADDR, MODULES_END,
-		DIV_ROUND_UP((MODULES_END - MODULES_VADDR), SZ_1M),
-
-		__init_begin, __init_end,
-		DIV_ROUND_UP((__init_end - __init_begin), SZ_1K),
-		_stext, _etext,
-		DIV_ROUND_UP((_etext - _stext), SZ_1K),
-		_sdata, _edata,
-		DIV_ROUND_UP((_edata - _sdata), SZ_1K));
 
 	BUILD_BUG_ON(TASK_SIZE				> MODULES_VADDR);
 	BUG_ON(TASK_SIZE				> MODULES_VADDR);
-- 
2.17.1


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

* Re: [PATCH] unicore32: Stop printing the virtual memory layout
  2018-08-28 14:23 [PATCH] unicore32: Stop printing the virtual memory layout Geert Uytterhoeven
@ 2018-08-28 14:30 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2018-08-28 14:30 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Guan Xuetao, LKML

On Tue, Aug 28, 2018 at 7:23 AM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> Since commit ad67b74d2469d9b8 ("printk: hash addresses printed with
> %p"), the virtual memory layout printed during boot up contains "ptrval"
> instead of actual addresses.
>
> Instead of changing the printing to "%px", and leaking virtual memory
> layout information again, just remove the printing completely, cfr. e.g.
> commits 071929dbdd865f77 ("arm64: Stop printing the virtual memory
> layout") and  31833332f7987636 ("m68k/mm: Stop printing the virtual
> memory layout").
>
> All interesting information (actual section sizes) is already printed by
> mem_init_print_info() just above anyway.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Nice!

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  arch/unicore32/mm/init.c | 24 ------------------------
>  1 file changed, 24 deletions(-)
>
> diff --git a/arch/unicore32/mm/init.c b/arch/unicore32/mm/init.c
> index f4950fbfe57493c7..1662058c272a5917 100644
> --- a/arch/unicore32/mm/init.c
> +++ b/arch/unicore32/mm/init.c
> @@ -344,30 +344,6 @@ void __init mem_init(void)
>         free_all_bootmem();
>
>         mem_init_print_info(NULL);
> -       printk(KERN_NOTICE "Virtual kernel memory layout:\n"
> -               "    vector  : 0x%08lx - 0x%08lx   (%4ld kB)\n"
> -               "    vmalloc : 0x%08lx - 0x%08lx   (%4ld MB)\n"
> -               "    lowmem  : 0x%08lx - 0x%08lx   (%4ld MB)\n"
> -               "    modules : 0x%08lx - 0x%08lx   (%4ld MB)\n"
> -               "      .init : 0x%p" " - 0x%p" "   (%4d kB)\n"
> -               "      .text : 0x%p" " - 0x%p" "   (%4d kB)\n"
> -               "      .data : 0x%p" " - 0x%p" "   (%4d kB)\n",
> -
> -               VECTORS_BASE, VECTORS_BASE + PAGE_SIZE,
> -               DIV_ROUND_UP(PAGE_SIZE, SZ_1K),
> -               VMALLOC_START, VMALLOC_END,
> -               DIV_ROUND_UP((VMALLOC_END - VMALLOC_START), SZ_1M),
> -               PAGE_OFFSET, (unsigned long)high_memory,
> -               DIV_ROUND_UP(((unsigned long)high_memory - PAGE_OFFSET), SZ_1M),
> -               MODULES_VADDR, MODULES_END,
> -               DIV_ROUND_UP((MODULES_END - MODULES_VADDR), SZ_1M),
> -
> -               __init_begin, __init_end,
> -               DIV_ROUND_UP((__init_end - __init_begin), SZ_1K),
> -               _stext, _etext,
> -               DIV_ROUND_UP((_etext - _stext), SZ_1K),
> -               _sdata, _edata,
> -               DIV_ROUND_UP((_edata - _sdata), SZ_1K));
>
>         BUILD_BUG_ON(TASK_SIZE                          > MODULES_VADDR);
>         BUG_ON(TASK_SIZE                                > MODULES_VADDR);
> --
> 2.17.1
>



-- 
Kees Cook
Pixel Security

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

end of thread, other threads:[~2018-08-28 14:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-28 14:23 [PATCH] unicore32: Stop printing the virtual memory layout Geert Uytterhoeven
2018-08-28 14:30 ` Kees Cook

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).