Bug 28859 - GCC calls malloc from within signal context
Summary: GCC calls malloc from within signal context
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.1.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
: 50041 (view as bug list)
Depends on:
Reported: 2006-08-26 21:09 UTC by Richard Biener
Modified: 2011-08-11 09:58 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2006-08-26 21:09:00 UTC
If running gcc with glibc malloc checking turned on (MALLOC_CHECK_=2), on heap
corruption the SIGABRT raised by glibc will cause gcc to deadlock because it
calls async-singal-unsafe malloc () from the signal context to do the diagnostic.
Comment 1 Andrew Pinski 2006-08-26 21:18:27 UTC
SIGABRT is not an async signal.  It is one of the few signal that is not.
Comment 2 Richard Biener 2006-08-26 21:25:02 UTC

"    All functions not in the above table are considered to be unsafe with respect to signals. In the presence of signals, all functions defined by this volume of IEEE Std 1003.1-2001 shall behave as defined when called from or interrupted by a signal-catching function, with a single exception: when a signal interrupts an unsafe function and the signal-catching function calls an unsafe function, the behavior is undefined."

malloc is not included in this list.

Now, it is unfortunate that glibc raises SIGABRT from inside malloc.
Comment 3 Richard Biener 2011-08-11 09:58:48 UTC
*** Bug 50041 has been marked as a duplicate of this bug. ***