Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1508802

[tip:x86/asm] mm/page_alloc: Remove kernel address exposure in free_reserved_area()

From tip-bot for Josh Poimboeuf <tipbot@zytor.com>
Newsgroups linux.kernel
Subject [tip:x86/asm] mm/page_alloc: Remove kernel address exposure in free_reserved_area()
Date 2016-10-26 07:50 +0200
Message-ID <swpg5-7Kg-1@gated-at.bofh.it> (permalink)
References <swbmO-6YY-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Commit-ID:  adb1fe9ae2ee6ef6bc10f3d5a588020e7664dfa7
Gitweb:     http://git.kernel.org/tip/adb1fe9ae2ee6ef6bc10f3d5a588020e7664dfa7
Author:     Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Tue, 25 Oct 2016 09:51:14 -0500
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 25 Oct 2016 18:40:37 +0200

mm/page_alloc: Remove kernel address exposure in free_reserved_area()

Linus suggested we try to remove some of the low-hanging fruit related
to kernel address exposure in dmesg.  The only leaks I see on my local
system are:

  Freeing SMP alternatives memory: 32K (ffffffff9e309000 - ffffffff9e311000)
  Freeing initrd memory: 10588K (ffffa0b736b42000 - ffffa0b737599000)
  Freeing unused kernel memory: 3592K (ffffffff9df87000 - ffffffff9e309000)
  Freeing unused kernel memory: 1352K (ffffa0b7288ae000 - ffffa0b728a00000)
  Freeing unused kernel memory: 632K (ffffa0b728d62000 - ffffa0b728e00000)

Linus says:

  "I suspect we should just remove [the addresses in the 'Freeing'
   messages]. I'm sure they are useful in theory, but I suspect they
   were more useful back when the whole "free init memory" was
   originally done.

   These days, if we have a use-after-free, I suspect the init-mem
   situation is the easiest situation by far. Compared to all the dynamic
   allocations which are much more likely to show it anyway. So having
   debug output for that case is likely not all that productive."

With this patch the freeing messages now look like this:

  Freeing SMP alternatives memory: 32K
  Freeing initrd memory: 10588K
  Freeing unused kernel memory: 3592K
  Freeing unused kernel memory: 1352K
  Freeing unused kernel memory: 632K

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/6836ff90c45b71d38e5d4405aec56fa9e5d1d4b2.1477405374.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 mm/page_alloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2b3bf67..3f63973 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6508,8 +6508,8 @@ unsigned long free_reserved_area(void *start, void *end, int poison, char *s)
 	}
 
 	if (pages && s)
-		pr_info("Freeing %s memory: %ldK (%p - %p)\n",
-			s, pages << (PAGE_SHIFT - 10), start, end);
+		pr_info("Freeing %s memory: %ldK\n",
+			s, pages << (PAGE_SHIFT - 10));
 
 	return pages;
 }

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] x86: fix kernel address printk exposures Josh Poimboeuf <jpoimboe@redhat.com> - 2016-10-25 17:00 +0200
  [PATCH 3/4] x86/dumpstack: remove raw stack dump Josh Poimboeuf <jpoimboe@redhat.com> - 2016-10-25 17:00 +0200
    [tip:x86/asm] x86/dumpstack: Remove raw stack dump tip-bot for Josh Poimboeuf <tipbot@zytor.com> - 2016-10-26 07:50 +0200
  [PATCH 1/4] scripts/faddr2line: fix "size mismatch" error Josh Poimboeuf <jpoimboe@redhat.com> - 2016-10-25 17:00 +0200
    [tip:x86/asm] scripts/faddr2line: Fix "size mismatch" error tip-bot for Josh Poimboeuf <tipbot@zytor.com> - 2016-10-26 07:50 +0200
  [PATCH 2/4] x86/dumpstack: remove kernel text addresses from stack dump Josh Poimboeuf <jpoimboe@redhat.com> - 2016-10-25 17:00 +0200
    [tip:x86/asm] x86/dumpstack: Remove kernel text addresses from  stack dump tip-bot for Josh Poimboeuf <tipbot@zytor.com> - 2016-10-26 07:50 +0200
  [PATCH 4/4] mm: remove kernel address exposure in free_reserved_area() Josh Poimboeuf <jpoimboe@redhat.com> - 2016-10-25 17:00 +0200
    [tip:x86/asm] mm/page_alloc: Remove kernel address exposure in  free_reserved_area() tip-bot for Josh Poimboeuf <tipbot@zytor.com> - 2016-10-26 07:50 +0200

csiph-web