about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-12-17 18:44:04 +0000
committerUlrich Drepper <drepper@redhat.com>2007-12-17 18:44:04 +0000
commit4cd4c5d6a28c4fbdc86651c4578f4c4f24efce08 (patch)
treee81dce1398009327dbb01c69339ac3ae278e7fa6
parentd9961b6a4ff8282a1700aa176c1c3f66b63f4bc6 (diff)
downloadglibc-4cd4c5d6a28c4fbdc86651c4578f4c4f24efce08.tar.gz
glibc-4cd4c5d6a28c4fbdc86651c4578f4c4f24efce08.tar.xz
glibc-4cd4c5d6a28c4fbdc86651c4578f4c4f24efce08.zip
* malloc/malloc.c (public_cALLOc): For arena other than
	main_arena, count all bytes inside the mprotect_size range of the
	heap as uninitialized.
-rw-r--r--ChangeLog6
-rw-r--r--malloc/malloc.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index c728e04016..4c23851981 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-12-17  Ulrich Drepper  <drepper@redhat.com>
+
+	* malloc/malloc.c (public_cALLOc): For arena other than
+	main_arena, count all bytes inside the mprotect_size range of the
+	heap as uninitialized.
+
 2007-12-16  Ulrich Drepper  <drepper@redhat.com>
 
 	* elf/tst-execstack.c (do_test): Don't fail if SELinux forbids
diff --git a/malloc/malloc.c b/malloc/malloc.c
index c54c203cbf..fc8a83c328 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3886,6 +3886,12 @@ public_cALLOc(size_t n, size_t elem_size)
       oldtopsize < mp_.sbrk_base + av->max_system_mem - (char *)oldtop)
     oldtopsize = (mp_.sbrk_base + av->max_system_mem - (char *)oldtop);
 #endif
+  if (av != &main_arena)
+    {
+      heap_info *heap = heap_for_ptr (oldtop);
+      if (oldtopsize < (char *) heap + heap->mprotect_size - (char *) oldtop)
+	oldtopsize = (char *) heap + heap->mprotect_size - (char *) oldtop;
+    }
 #endif
   mem = _int_malloc(av, sz);