linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: poison initmem when it is freed
@ 2011-07-05 18:42 Russell King - ARM Linux
  2011-07-05 19:17 ` Nicolas Pitre
  0 siblings, 1 reply; 15+ messages in thread
From: Russell King - ARM Linux @ 2011-07-05 18:42 UTC (permalink / raw)
  To: linux-arm-kernel

When the initmem is freed, we can no longer rely on its contents.  In
lightly loaded systems, this memory may persist for some time, making
it harder discover run-time issues (caused by the build warnings being
ignored.)

Poison the initmem at the point where it is freed to encourage run-time
problems when initmem is dereferenced as an aid to finding such problems.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/mm/init.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 2c2cce9..46c39bd 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -19,6 +19,7 @@
 #include <linux/highmem.h>
 #include <linux/gfp.h>
 #include <linux/memblock.h>
+#include <linux/poison.h>
 #include <linux/sort.h>
 
 #include <asm/mach-types.h>
@@ -701,6 +702,8 @@ void free_initmem(void)
 				    "TCM link");
 #endif
 
+	memset(__init_begin, POISON_FREE_INITMEM, __init_end - __init_begin);
+
 	if (!machine_is_integrator() && !machine_is_cintegrator())
 		totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)),
 					    __phys_to_pfn(__pa(__init_end)),

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

end of thread, other threads:[~2011-07-07 17:44 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-05 18:42 [PATCH] ARM: poison initmem when it is freed Russell King - ARM Linux
2011-07-05 19:17 ` Nicolas Pitre
2011-07-05 19:26   ` Russell King - ARM Linux
2011-07-05 19:48     ` Nicolas Pitre
2011-07-05 23:34       ` Stephen Boyd
2011-07-06 20:34         ` Russell King - ARM Linux
2011-07-06 20:55           ` Stephen Boyd
2011-07-06 21:01             ` Russell King - ARM Linux
2011-07-06 21:45               ` Tim Bird
2011-07-07 16:47               ` [PATCHv2] arm: mm: Poison freed init memory Stephen Boyd
2011-07-07 17:36                 ` Russell King - ARM Linux
2011-07-07 17:44                   ` Stephen Boyd
2011-07-07 17:41                 ` Nicolas Pitre
2011-07-06  9:08       ` [PATCH] ARM: poison initmem when it is freed Tixy
2011-07-06 20:35         ` Russell King - ARM Linux

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