public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sources.redhat.com Subject: [Bug malloc/14562] threaded programs with x32 abi randomly crash with arena.c:661: heap_trim: Assertion `p->size == (0|0x1)' failed Date: Sat, 08 Sep 2012 20:48:00 -0000 [thread overview] Message-ID: <bug-14562-131-zYmckGLEzH@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-14562-131@http.sourceware.org/bugzilla/> http://sourceware.org/bugzilla/show_bug.cgi?id=14562 --- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> 2012-09-08 20:48:37 UTC --- This is the right one: diff --git a/malloc/arena.c b/malloc/arena.c index f88b41d..8d52109 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -655,14 +655,18 @@ heap_trim(heap_info *heap, size_t pad) mchunkptr top_chunk = top(ar_ptr), p, bck, fwd; heap_info *prev_heap; long new_size, top_size, extra; + unsigned long 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)); + /* fencepost must be properly aligned. */ + misalign = ((unsigned long) p) & MALLOC_ALIGN_MASK; + p = (mchunkptr)(((unsigned long) p) & ~MALLOC_ALIGN_MASK); 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; -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
next prev parent reply other threads:[~2012-09-08 20:48 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-09-07 23:49 [Bug nptl/14562] New: " vapier at gentoo dot org 2012-09-08 0:43 ` [Bug nptl/14562] " hjl.tools at gmail dot com 2012-09-08 1:03 ` hjl.tools at gmail dot com 2012-09-08 4:03 ` hjl.tools at gmail dot com 2012-09-08 14:04 ` [Bug malloc/14562] " hjl.tools at gmail dot com 2012-09-08 14:52 ` hjl.tools at gmail dot com 2012-09-08 15:30 ` hjl.tools at gmail dot com 2012-09-08 20:44 ` hjl.tools at gmail dot com 2012-09-08 20:48 ` hjl.tools at gmail dot com [this message] 2012-09-08 20:58 ` hjl.tools at gmail dot com 2012-09-09 18:30 ` hjl.tools at gmail dot com 2012-09-10 5:42 ` vapier at gentoo dot org 2012-09-10 17:59 ` dschepler at gmail dot com 2012-09-25 0:21 ` hjl.tools at gmail dot com 2012-09-26 18:33 ` hjl.tools at gmail dot com 2014-06-25 6:48 ` fweimer at redhat dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-14562-131-zYmckGLEzH@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sources.redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).