[PATCH 3.18 61/92] mm/page_alloc: Remove kernel address exposure in free_reserved_area()

2017-08-09 Thread Greg Kroah-Hartman
3.18-stable review patch.  If anyone has any objections, please let me know.

--

From: Josh Poimboeuf 

commit adb1fe9ae2ee6ef6bc10f3d5a588020e7664dfa7 upstream.

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 (9e309000 - 9e311000)
  Freeing initrd memory: 10588K (a0b736b42000 - a0b737599000)
  Freeing unused kernel memory: 3592K (9df87000 - 9e309000)
  Freeing unused kernel memory: 1352K (a0b7288ae000 - a0b728a0)
  Freeing unused kernel memory: 632K (a0b728d62000 - a0b728e0)

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 
Signed-off-by: Josh Poimboeuf 
Cc: Andy Lutomirski 
Cc: Borislav Petkov 
Cc: Brian Gerst 
Cc: Denys Vlasenko 
Cc: H. Peter Anvin 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: linux...@kvack.org
Link: 
http://lkml.kernel.org/r/6836ff90c45b71d38e5d4405aec56fa9e5d1d4b2.1477405374.git.jpoim...@redhat.com
Signed-off-by: Ingo Molnar 
Cc: Kees Cook 
Signed-off-by: Greg Kroah-Hartman 

---
 mm/page_alloc.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5467,8 +5467,8 @@ unsigned long free_reserved_area(void *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;
 }




[PATCH 3.18 61/92] mm/page_alloc: Remove kernel address exposure in free_reserved_area()

2017-08-09 Thread Greg Kroah-Hartman
3.18-stable review patch.  If anyone has any objections, please let me know.

--

From: Josh Poimboeuf 

commit adb1fe9ae2ee6ef6bc10f3d5a588020e7664dfa7 upstream.

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 (9e309000 - 9e311000)
  Freeing initrd memory: 10588K (a0b736b42000 - a0b737599000)
  Freeing unused kernel memory: 3592K (9df87000 - 9e309000)
  Freeing unused kernel memory: 1352K (a0b7288ae000 - a0b728a0)
  Freeing unused kernel memory: 632K (a0b728d62000 - a0b728e0)

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 
Signed-off-by: Josh Poimboeuf 
Cc: Andy Lutomirski 
Cc: Borislav Petkov 
Cc: Brian Gerst 
Cc: Denys Vlasenko 
Cc: H. Peter Anvin 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: linux...@kvack.org
Link: 
http://lkml.kernel.org/r/6836ff90c45b71d38e5d4405aec56fa9e5d1d4b2.1477405374.git.jpoim...@redhat.com
Signed-off-by: Ingo Molnar 
Cc: Kees Cook 
Signed-off-by: Greg Kroah-Hartman 

---
 mm/page_alloc.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5467,8 +5467,8 @@ unsigned long free_reserved_area(void *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;
 }