public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/10776] New: With M_MMAP_MAX=0 free() causes undefined behaviour.
@ 2009-10-14 13:03 Christian dot Meier at informatik dot stud dot uni-erlangen dot de
  2009-10-14 13:11 ` [Bug libc/10776] " Christian dot Meier at informatik dot stud dot uni-erlangen dot de
  2009-10-29 20:28 ` drepper at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: Christian dot Meier at informatik dot stud dot uni-erlangen dot de @ 2009-10-14 13:03 UTC (permalink / raw)
  To: glibc-bugs

Calling the following at the beginning of main causes an application (with many
allocations) to behave undefined.

if (mlockall(MCL_CRRENT|MCL_FUTURE))
  return 1;

mallopt(M_TRIM_THRESHOLD, -1);
mallopt(M_MMAP_MAX, 0);
int * buffer = (int*) malloc(10*1024*1024);

if (!buffer)
  return 1;

for (int i = 0; i < 10*1024*1024/sizeof(int); ++i) {
  buffer[i] = 42;
}
free(buffer);

However, commenting out either free(buffer); or mallopt(M_MAP_MAX, 0); causes
the application to behave as expected.

-- 
           Summary: With M_MMAP_MAX=0 free() causes undefined behaviour.
           Product: glibc
           Version: 2.10
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: Christian dot Meier at informatik dot stud dot uni-
                    erlangen dot de
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=10776

------- 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] 3+ messages in thread

* [Bug libc/10776] With M_MMAP_MAX=0 free() causes undefined behaviour.
  2009-10-14 13:03 [Bug libc/10776] New: With M_MMAP_MAX=0 free() causes undefined behaviour Christian dot Meier at informatik dot stud dot uni-erlangen dot de
@ 2009-10-14 13:11 ` Christian dot Meier at informatik dot stud dot uni-erlangen dot de
  2009-10-29 20:28 ` drepper at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: Christian dot Meier at informatik dot stud dot uni-erlangen dot de @ 2009-10-14 13:11 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From Christian dot Meier at informatik dot stud dot uni-erlangen dot de  2009-10-14 13:10 -------
Commenting out the buffer write loop also causes the application to behave as
expected.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10776

------- 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] 3+ messages in thread

* [Bug libc/10776] With M_MMAP_MAX=0 free() causes undefined behaviour.
  2009-10-14 13:03 [Bug libc/10776] New: With M_MMAP_MAX=0 free() causes undefined behaviour Christian dot Meier at informatik dot stud dot uni-erlangen dot de
  2009-10-14 13:11 ` [Bug libc/10776] " Christian dot Meier at informatik dot stud dot uni-erlangen dot de
@ 2009-10-29 20:28 ` drepper at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: drepper at redhat dot com @ 2009-10-29 20:28 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2009-10-29 20:28 -------
There isn't enough information in the report.  Provide a small, self-contained
test case.  Otherwise debug your program and point to the problem.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


http://sourceware.org/bugzilla/show_bug.cgi?id=10776

------- 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] 3+ messages in thread

end of thread, other threads:[~2009-10-29 20:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-14 13:03 [Bug libc/10776] New: With M_MMAP_MAX=0 free() causes undefined behaviour Christian dot Meier at informatik dot stud dot uni-erlangen dot de
2009-10-14 13:11 ` [Bug libc/10776] " Christian dot Meier at informatik dot stud dot uni-erlangen dot de
2009-10-29 20:28 ` drepper 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).