public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug linuxthreads/1337] New: reports "malloc: top chunk is corrupt" when allocates second 2GB of memory buffer after pthread_create()
@ 2005-09-13 16:47 igorodet at cray dot com
2005-09-13 17:15 ` [Bug linuxthreads/1337] " jakub at redhat dot com
0 siblings, 1 reply; 2+ messages in thread
From: igorodet at cray dot com @ 2005-09-13 16:47 UTC (permalink / raw)
To: glibc-bugs
OS: SuSe 2.6.5
CPU: AMD Opteron (2 way SMP)
Memory: 8 GB
Steps to reproduce:
1. Compile the following program WITHOUT '-static' option set
2. set env. variable MALLOC_CHECK_ to 1
3. execute program
Output I see:
******************
malloc: using debugging hooks
malloc: top chunk is corrupt
free(): invalid pointer 0x2a959a4010!
free(): invalid pointer 0x2b159c5010!
s_buf=0x2a959a4010 r_buf=0x2b159c5010 size=0x80000000
******************
4. Compile with '-static' - problem disappears
5. Run dynamically compiled version, but with env. variable
'export LD_ASSUME_KERNEL=2.4.1' - problem does not exist
Program:
*****************************************************
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
char *s_buf;
char *r_buf;
static void *
ErrorHandler(void *arg)
{
}
int main(int argc,char *argv[])
{
int i;
size_t size = 2*1024*1024*1024L;;
int loop;
pthread_t pthr_hndl;
int res;
res = mallopt(M_MMAP_MAX, 0);
pthread_create(&pthr_hndl, NULL, ErrorHandler, NULL);
pthread_join(pthr_hndl, NULL);
s_buf = malloc(size);
r_buf = malloc(size);
printf("s_buf=%p r_buf=%p size=0x%lx \n", s_buf, r_buf, size);
free(s_buf);
free(r_buf);
return 0;
}
************************************************************************
Comments:
Problem exists only when M_MMAP_MAX is set to 1 (or 2) and program creates thread.
Looks like in this case malloc tries to use mmap and then gets confused when
performs heap integrity checks.
--
Summary: reports "malloc: top chunk is corrupt" when allocates
second 2GB of memory buffer after pthread_create()
Product: glibc
Version: 2.3.3
Status: NEW
Severity: normal
Priority: P2
Component: linuxthreads
AssignedTo: gotom at debian dot or dot jp
ReportedBy: igorodet at cray dot com
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=1337
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug linuxthreads/1337] reports "malloc: top chunk is corrupt" when allocates second 2GB of memory buffer after pthread_create()
2005-09-13 16:47 [Bug linuxthreads/1337] New: reports "malloc: top chunk is corrupt" when allocates second 2GB of memory buffer after pthread_create() igorodet at cray dot com
@ 2005-09-13 17:15 ` jakub at redhat dot com
0 siblings, 0 replies; 2+ messages in thread
From: jakub at redhat dot com @ 2005-09-13 17:15 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From jakub at redhat dot com 2005-09-13 17:15 -------
Works just fine here with glibc 2.3.5. There have been several MALLOC_CHECK_
fixes recently.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WORKSFORME
http://sourceware.org/bugzilla/show_bug.cgi?id=1337
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-09-13 17:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-13 16:47 [Bug linuxthreads/1337] New: reports "malloc: top chunk is corrupt" when allocates second 2GB of memory buffer after pthread_create() igorodet at cray dot com
2005-09-13 17:15 ` [Bug linuxthreads/1337] " jakub at redhat dot com
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).