This is the mail archive of the glibc-bugs@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]

[Bug libc/214] sbrk() doesn't detect brk() failures. Malloc doesn't handle sbrk() failures


------- Additional Comments From rsa at us dot ibm dot com  2006-03-03 22:01 -------
Created an attachment (id=901)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=901&action=view)
testcase to demonstrate setrlimit() and sbrk()

This source file provides a testcase.  It basically sets the rlimit and then
incrementally increases the data segment size with sbrk() until an error is
returned.  This happens to be when the data segment exceeds the hard limit of 1
page.

Compile with:

gcc -o glibc214 glibc214.c -DSBRK_EARLYSBRK

setrlimit() must be preceeded by an initial call to sbrk() or subsequent sbrk()
calls will fail.  That is what the flag demonstrates; take it out and the test
will fail very quickly.

I tested this on powerpc32, powerpc64, and an i486 and didn't experience the
problem that the bug addresses.

		 gcc		 glibc	   kernel
powerpc32    4.1.0 20060130	2.3.90	  2.6.5-7.244-pseries64
powerpc64    4.1.0 20060130	2.3.90	  2.6.5-7.244-pseries64
i486	     4.0.3 20051201	2.3.5	  2.6.12-1-k7

-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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