linux-m68k.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] m68k/mm: Stop printing the virtual memory layout
       [not found] <1518425633-19803-1-git-send-email-geert@linux-m68k.org>
@ 2018-02-13  0:48 ` Finn Thain
  2018-02-13  7:34   ` Geert Uytterhoeven
  0 siblings, 1 reply; 3+ messages in thread
From: Finn Thain @ 2018-02-13  0:48 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, Greg Ungerer, Kees Cook, linux-kernel

On Mon, 12 Feb 2018, Geert Uytterhoeven wrote:

> Since commit ad67b74d2469d9b8 ("printk: hash addresses printed with
> %p"), the virtual memory layout printed during boot up contains "ptrval"
> instead of actual addresses:
> 
>     Memory: 268040K/276480K available (2979K kernel code, 310K rwdata, 784K rodata, 144K init, 172K bss, 8440K reserved, 0K cma-reserved)
>     Virtual kernel memory layout:
> 	vector  : 0x003d2e74 - 0x003d3274   (   1 KiB)
> 	kmap    : 0xd0000000 - 0xf0000000   ( 512 MiB)
> 	vmalloc : 0x11800000 - 0xd0000000   (3048 MiB)
> 	lowmem  : 0x00000000 - 0x11000000   ( 272 MiB)
> 	  .init : 0x(ptrval) - 0x(ptrval)   ( 144 KiB)
> 	  .text : 0x(ptrval) - 0x(ptrval)   (2980 KiB)
> 	  .data : 0x(ptrval) - 0x(ptrval)   (1095 KiB)
> 	  .bss  : 0x(ptrval) - 0x(ptrval)   ( 173 KiB)
> 
> Instead of changing the printing to "%px", and leaking virtual memory
> layout information again,
> 
> just remove the printing completely, cfr. e.g.
> commit 071929dbdd865f77 ("arm64: Stop printing the virtual memory
> layout").
> 
> All interesting information (actual section sizes) is already printed by
> mem_init_print_info() just above anyway.
> 

Or maybe revert to %lx with pr_debug instead of pr_notice. Just a thought; 
I don't have any preference.

-- 

> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
>  arch/m68k/mm/init.c | 27 ---------------------------
>  1 file changed, 27 deletions(-)
> 
> diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
> index e85acd131fa8fe76..8827b7f914025595 100644
> --- a/arch/m68k/mm/init.c
> +++ b/arch/m68k/mm/init.c
> @@ -120,32 +120,6 @@ void free_initmem(void)
>  #define VECTORS	_ramvec
>  #endif
>  
> -void __init print_memmap(void)
> -{
> -#define UL(x) ((unsigned long) (x))
> -#define MLK(b, t) UL(b), UL(t), (UL(t) - UL(b)) >> 10
> -#define MLM(b, t) UL(b), UL(t), (UL(t) - UL(b)) >> 20
> -#define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), 1024)
> -
> -	pr_notice("Virtual kernel memory layout:\n"
> -		"    vector  : 0x%08lx - 0x%08lx   (%4ld KiB)\n"
> -		"    kmap    : 0x%08lx - 0x%08lx   (%4ld MiB)\n"
> -		"    vmalloc : 0x%08lx - 0x%08lx   (%4ld MiB)\n"
> -		"    lowmem  : 0x%08lx - 0x%08lx   (%4ld MiB)\n"
> -		"      .init : 0x%p" " - 0x%p" "   (%4d KiB)\n"
> -		"      .text : 0x%p" " - 0x%p" "   (%4d KiB)\n"
> -		"      .data : 0x%p" " - 0x%p" "   (%4d KiB)\n"
> -		"      .bss  : 0x%p" " - 0x%p" "   (%4d KiB)\n",
> -		MLK(VECTORS, VECTORS + 256),
> -		MLM(KMAP_START, KMAP_END),
> -		MLM(VMALLOC_START, VMALLOC_END),
> -		MLM(PAGE_OFFSET, (unsigned long)high_memory),
> -		MLK_ROUNDUP(__init_begin, __init_end),
> -		MLK_ROUNDUP(_stext, _etext),
> -		MLK_ROUNDUP(_sdata, _edata),
> -		MLK_ROUNDUP(__bss_start, __bss_stop));
> -}
> -
>  static inline void init_pointer_tables(void)
>  {
>  #if defined(CONFIG_MMU) && !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
> @@ -170,7 +144,6 @@ void __init mem_init(void)
>  	free_all_bootmem();
>  	init_pointer_tables();
>  	mem_init_print_info(NULL);
> -	print_memmap();
>  }
>  
>  #ifdef CONFIG_BLK_DEV_INITRD
> 

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

* Re: [PATCH] m68k/mm: Stop printing the virtual memory layout
  2018-02-13  0:48 ` [PATCH] m68k/mm: Stop printing the virtual memory layout Finn Thain
@ 2018-02-13  7:34   ` Geert Uytterhoeven
  0 siblings, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2018-02-13  7:34 UTC (permalink / raw)
  To: Finn Thain; +Cc: linux-m68k, Greg Ungerer, Kees Cook, Linux Kernel Mailing List

Hi Finn,

On Tue, Feb 13, 2018 at 1:48 AM, Finn Thain <fthain@telegraphics.com.au> wrote:
> On Mon, 12 Feb 2018, Geert Uytterhoeven wrote:
>> Since commit ad67b74d2469d9b8 ("printk: hash addresses printed with
>> %p"), the virtual memory layout printed during boot up contains "ptrval"
>> instead of actual addresses:
>>
>>     Memory: 268040K/276480K available (2979K kernel code, 310K rwdata, 784K rodata, 144K init, 172K bss, 8440K reserved, 0K cma-reserved)
>>     Virtual kernel memory layout:
>>       vector  : 0x003d2e74 - 0x003d3274   (   1 KiB)
>>       kmap    : 0xd0000000 - 0xf0000000   ( 512 MiB)
>>       vmalloc : 0x11800000 - 0xd0000000   (3048 MiB)
>>       lowmem  : 0x00000000 - 0x11000000   ( 272 MiB)
>>         .init : 0x(ptrval) - 0x(ptrval)   ( 144 KiB)
>>         .text : 0x(ptrval) - 0x(ptrval)   (2980 KiB)
>>         .data : 0x(ptrval) - 0x(ptrval)   (1095 KiB)
>>         .bss  : 0x(ptrval) - 0x(ptrval)   ( 173 KiB)
>>
>> Instead of changing the printing to "%px", and leaking virtual memory
>> layout information again,
>>
>> just remove the printing completely, cfr. e.g.
>> commit 071929dbdd865f77 ("arm64: Stop printing the virtual memory
>> layout").
>>
>> All interesting information (actual section sizes) is already printed by
>> mem_init_print_info() just above anyway.
>
> Or maybe revert to %lx with pr_debug instead of pr_notice. Just a thought;

(%px prints unhashed pointers, no need for %lx and cast)

> I don't have any preference.

Dynamic debug is hot these days, so that may be enabled by distros,
still leaking the info.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

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

* [PATCH] m68k/mm: Stop printing the virtual memory layout
@ 2018-02-12  8:53 Geert Uytterhoeven
  0 siblings, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2018-02-12  8:53 UTC (permalink / raw)
  To: linux-m68k; +Cc: Greg Ungerer, 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:

    Memory: 268040K/276480K available (2979K kernel code, 310K rwdata, 784K rodata, 144K init, 172K bss, 8440K reserved, 0K cma-reserved)
    Virtual kernel memory layout:
	vector  : 0x003d2e74 - 0x003d3274   (   1 KiB)
	kmap    : 0xd0000000 - 0xf0000000   ( 512 MiB)
	vmalloc : 0x11800000 - 0xd0000000   (3048 MiB)
	lowmem  : 0x00000000 - 0x11000000   ( 272 MiB)
	  .init : 0x(ptrval) - 0x(ptrval)   ( 144 KiB)
	  .text : 0x(ptrval) - 0x(ptrval)   (2980 KiB)
	  .data : 0x(ptrval) - 0x(ptrval)   (1095 KiB)
	  .bss  : 0x(ptrval) - 0x(ptrval)   ( 173 KiB)

Instead of changing the printing to "%px", and leaking virtual memory
layout information again, just remove the printing completely, cfr. e.g.
commit 071929dbdd865f77 ("arm64: 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@linux-m68k.org>
---
 arch/m68k/mm/init.c | 27 ---------------------------
 1 file changed, 27 deletions(-)

diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index e85acd131fa8fe76..8827b7f914025595 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -120,32 +120,6 @@ void free_initmem(void)
 #define VECTORS	_ramvec
 #endif
 
-void __init print_memmap(void)
-{
-#define UL(x) ((unsigned long) (x))
-#define MLK(b, t) UL(b), UL(t), (UL(t) - UL(b)) >> 10
-#define MLM(b, t) UL(b), UL(t), (UL(t) - UL(b)) >> 20
-#define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), 1024)
-
-	pr_notice("Virtual kernel memory layout:\n"
-		"    vector  : 0x%08lx - 0x%08lx   (%4ld KiB)\n"
-		"    kmap    : 0x%08lx - 0x%08lx   (%4ld MiB)\n"
-		"    vmalloc : 0x%08lx - 0x%08lx   (%4ld MiB)\n"
-		"    lowmem  : 0x%08lx - 0x%08lx   (%4ld MiB)\n"
-		"      .init : 0x%p" " - 0x%p" "   (%4d KiB)\n"
-		"      .text : 0x%p" " - 0x%p" "   (%4d KiB)\n"
-		"      .data : 0x%p" " - 0x%p" "   (%4d KiB)\n"
-		"      .bss  : 0x%p" " - 0x%p" "   (%4d KiB)\n",
-		MLK(VECTORS, VECTORS + 256),
-		MLM(KMAP_START, KMAP_END),
-		MLM(VMALLOC_START, VMALLOC_END),
-		MLM(PAGE_OFFSET, (unsigned long)high_memory),
-		MLK_ROUNDUP(__init_begin, __init_end),
-		MLK_ROUNDUP(_stext, _etext),
-		MLK_ROUNDUP(_sdata, _edata),
-		MLK_ROUNDUP(__bss_start, __bss_stop));
-}
-
 static inline void init_pointer_tables(void)
 {
 #if defined(CONFIG_MMU) && !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
@@ -170,7 +144,6 @@ void __init mem_init(void)
 	free_all_bootmem();
 	init_pointer_tables();
 	mem_init_print_info(NULL);
-	print_memmap();
 }
 
 #ifdef CONFIG_BLK_DEV_INITRD
-- 
2.7.4

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

end of thread, other threads:[~2018-02-13  7:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1518425633-19803-1-git-send-email-geert@linux-m68k.org>
2018-02-13  0:48 ` [PATCH] m68k/mm: Stop printing the virtual memory layout Finn Thain
2018-02-13  7:34   ` Geert Uytterhoeven
2018-02-12  8:53 Geert Uytterhoeven

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