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

sysconf can call malloc?


While debugging a garbage collector patch, I ran across a stack trace,
from which I extracted the interesting middle section here:  (This is
with libc-2.3.6 on an IA64 box.  Apologies in advance if this has
already been fixed.  It seemed like a problem that would be hard to
detect otherwise, so I posted anyway:)

#6  0x2000000000064530 in malloc (lb=568) at ../bdwgc/malloc.c:319
#7  0x20000000001d0680 in fgets () from /lib/tls/libc.so.6.1
#8  0x20000000001d07f0 in fopen () from /lib/tls/libc.so.6.1
#9  0x20000000002c0130 in setmntent () from /lib/tls/libc.so.6.1
#10 0x20000000002cbd70 in ustat () from /lib/tls/libc.so.6.1
#11 0x20000000002cbfe0 in ustat () from /lib/tls/libc.so.6.1
#12 0x20000000002538e0 in sysconf () from /lib/tls/libc.so.6.1
#13 0x200000000017ba80 in qsort () from /lib/tls/libc.so.6.1

This causes me problems, since I happened to be calling qsort from
malloc, since I didn't think it could possibly call malloc.  But I
really have no good justification for that assumption, and I'll use
something else.

But this looks wrong to me for more serious reasons:  sysconf() is
required to be async-signal-safe.  Malloc is not required to be, and I'm
pretty sure libc's malloc is not.  (Neither is mine.)  Am I missing
something?

Thanks.

Hans


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