This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.16-ports-merge-351-gced6f16


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  ced6f16ee919d12725840d43d007f1cfd67118df (commit)
      from  a9f8e53a5b14ba481999ded036b025554ea06362 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ced6f16ee919d12725840d43d007f1cfd67118df

commit ced6f16ee919d12725840d43d007f1cfd67118df
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Sep 24 08:58:04 2012 -0700

    Properly handle fencepost with MALLOC_ALIGN_MASK

diff --git a/ChangeLog b/ChangeLog
index b8c492e..e3329b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-09-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+	[BZ #14562]
+	* malloc/arena.c (heap_trim): Properly get fencepost and adjust
+	new chunk size with MALLOC_ALIGN_MASK.
+
 2012-09-24  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #5044]
diff --git a/NEWS b/NEWS
index 84c05d5..33f86a1 100644
--- a/NEWS
+++ b/NEWS
@@ -14,7 +14,7 @@ Version 2.17
   14151, 14154, 14157, 14166, 14173, 14195, 14237, 14252, 14283, 14298,
   14303, 14307, 14328, 14331, 14336, 14337, 14347, 14349, 14459, 14476,
   14505, 14510, 14516, 14518, 14519, 14532, 14538, 14544, 14545, 14576,
-  14579, 14583, 14587.
+  14579, 14583, 14587, 14562.
 
 * Support for STT_GNU_IFUNC symbols added for s390 and s390x.
   Optimized versions of memcpy, memset, and memcmp added for System z10 and
diff --git a/malloc/arena.c b/malloc/arena.c
index 97c0b90..f24e76c 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -655,15 +655,19 @@ heap_trim(heap_info *heap, size_t pad)
   unsigned long pagesz = GLRO(dl_pagesize);
   mchunkptr top_chunk = top(ar_ptr), p, bck, fwd;
   heap_info *prev_heap;
-  long new_size, top_size, extra;
+  long new_size, top_size, extra, prev_size, misalign;
 
   /* Can this heap go away completely? */
   while(top_chunk == chunk_at_offset(heap, sizeof(*heap))) {
     prev_heap = heap->prev;
-    p = chunk_at_offset(prev_heap, prev_heap->size - (MINSIZE-2*SIZE_SZ));
+    prev_size = prev_heap->size - (MINSIZE-2*SIZE_SZ);
+    p = chunk_at_offset(prev_heap, prev_size);
+    /* fencepost must be properly aligned.  */
+    misalign = ((long) p) & MALLOC_ALIGN_MASK;
+    p = chunk_at_offset(prev_heap, prev_size - misalign);
     assert(p->size == (0|PREV_INUSE)); /* must be fencepost */
     p = prev_chunk(p);
-    new_size = chunksize(p) + (MINSIZE-2*SIZE_SZ);
+    new_size = chunksize(p) + (MINSIZE-2*SIZE_SZ) + misalign;
     assert(new_size>0 && new_size<(long)(2*MINSIZE));
     if(!prev_inuse(p))
       new_size += p->prev_size;

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog      |    6 ++++++
 NEWS           |    2 +-
 malloc/arena.c |   10 +++++++---
 3 files changed, 14 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]