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/12232] setrlimit interferes with malloc


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

--- Comment #20 from Bruce Korb <bkorb at gnu dot org> 2011-01-10 16:00:31 UTC ---
(In reply to comment #19)
> Stop reopening this bug.  There is no bug except in your assumptions.

I could open a new one with a better description, there having been
some progress in understanding in the mean time.  WRT the problem
itself, we know for certain that the process is much smaller than
10Meg and that we set the process address space limit to 10Meg.
We also know that the first tiny allocation fails.  glibc should
support this.  If that is a bad assumption, then glibc *MUST DOCUMENT*
any further constraints, like minimum address space.  If you wish
to require glibc clients to have a minimum of 16 Meg, then
document the constraint, please.  Until then, you have a bug.
(And if you think it is a kernel bug, then please carry it forward.
After all, I cannot go to the kernel folks and say, "You have a bug
because Ulrich said so."  You know much better than I do what goes
on between malloc and the kernel.)

In sum: this _is_ a bug, either against malloc or setrlimit.  You pick.

FWIW, below is a copy of /proc/pid/maps during a live gdb session:

94            if (fprintf (stdout, "%011000d\n", 17) == -1
(gdb) ^Z
[1]+  Stopped(SIGTSTP)        gdb --args ./$f 1
$ cat /proc/8496/maps 
00400000-00404000 r-xp 00000000 09:00 4228629                           
/old-home/gnu/proj/gnulib/libposix/_b/libposix-0.1.libposix-6-03d3-dirty/_build/tests/test-fprintf-posix3
00604000-00605000 r--p 00004000 09:00 4228629                           
/old-home/gnu/proj/gnulib/libposix/_b/libposix-0.1.libposix-6-03d3-dirty/_build/tests/test-fprintf-posix3
00605000-00606000 rw-p 00005000 09:00 4228629                           
/old-home/gnu/proj/gnulib/libposix/_b/libposix-0.1.libposix-6-03d3-dirty/_build/tests/test-fprintf-posix3
7ffff7401000-7ffff7418000 r-xp 00000000 08:06 9043976                   
/lib64/libpthread-2.11.2.so
7ffff7418000-7ffff7618000 ---p 00017000 08:06 9043976                   
/lib64/libpthread-2.11.2.so
7ffff7618000-7ffff7619000 r--p 00017000 08:06 9043976                   
/lib64/libpthread-2.11.2.so
7ffff7619000-7ffff761a000 rw-p 00018000 08:06 9043976                   
/lib64/libpthread-2.11.2.so
7ffff761a000-7ffff761e000 rw-p 00000000 00:00 0 
7ffff761e000-7ffff7774000 r-xp 00000000 08:06 9044083                   
/lib64/libc-2.11.2.so
7ffff7774000-7ffff7974000 ---p 00156000 08:06 9044083                   
/lib64/libc-2.11.2.so
7ffff7974000-7ffff7978000 r--p 00156000 08:06 9044083                   
/lib64/libc-2.11.2.so
7ffff7978000-7ffff7979000 rw-p 0015a000 08:06 9044083                   
/lib64/libc-2.11.2.so
7ffff7979000-7ffff797e000 rw-p 00000000 00:00 0 
7ffff797e000-7ffff79d4000 r-xp 00000000 08:06 9044230                   
/lib64/libm-2.11.2.so
7ffff79d4000-7ffff7bd3000 ---p 00056000 08:06 9044230                   
/lib64/libm-2.11.2.so
7ffff7bd3000-7ffff7bd4000 r--p 00055000 08:06 9044230                   
/lib64/libm-2.11.2.so
7ffff7bd4000-7ffff7bd5000 rw-p 00056000 08:06 9044230                   
/lib64/libm-2.11.2.so
7ffff7bd5000-7ffff7bdd000 r-xp 00000000 08:06 9044289                   
/lib64/librt-2.11.2.so
7ffff7bdd000-7ffff7ddc000 ---p 00008000 08:06 9044289                   
/lib64/librt-2.11.2.so
7ffff7ddc000-7ffff7ddd000 r--p 00007000 08:06 9044289                   
/lib64/librt-2.11.2.so
7ffff7ddd000-7ffff7dde000 rw-p 00008000 08:06 9044289                   
/lib64/librt-2.11.2.so
7ffff7dde000-7ffff7dfd000 r-xp 00000000 08:06 9044076                   
/lib64/ld-2.11.2.so
7ffff7fc8000-7ffff7fcc000 rw-p 00000000 00:00 0 
7ffff7ffa000-7ffff7ffb000 rw-p 00000000 00:00 0 
7ffff7ffb000-7ffff7ffc000 r-xp 00000000 00:00 0                          [vdso]
7ffff7ffc000-7ffff7ffd000 r--p 0001e000 08:06 9044076                   
/lib64/ld-2.11.2.so
7ffff7ffd000-7ffff7ffe000 rw-p 0001f000 08:06 9044076                   
/lib64/ld-2.11.2.so
7ffff7ffe000-7ffff7fff000 rw-p 00000000 00:00 0 
7ffffffde000-7ffffffff000 rw-p 00000000 00:00 0                         
[stack]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                 
[vsyscall]

Compiling -O0 and static linking yielded a larger image:
$ size core-test-fprintf-posix3 
   text    data     bss     dec     hex filename
1687552  225280       0 1912832  1d3000 ....
though still much smaller than 10000000.

-- 
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.


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