This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: malloc/free is signal-safe?
- From: Florian Weimer <fweimer at redhat dot com>
- To: Dimitrios Apostolou <jimis at gmx dot net>
- Cc: libc-help at sourceware dot org
- Date: Tue, 04 Jun 2013 12:15:37 +0200
- Subject: Re: malloc/free is signal-safe?
- References: <alpine dot DEB dot 2 dot 02 dot 1306041057460 dot 4769 at localhost> <CAAHN_R1cUo2Y=FE_L9Jz05yCNhhe938bvgfBzB4jzRwMuwy-fQ at mail dot gmail dot com> <alpine dot DEB dot 2 dot 02 dot 1306041206490 dot 4769 at localhost>
On 06/04/2013 12:07 PM, Dimitrios Apostolou wrote:
Quoting
http://www.cs.utah.edu/dept/old/texinfo/glibc-manual-0.02/library_21.html
On the GNU system, malloc and free are safe to use in signal handlers
because it blocks signals. As a result, the library functions that
allocate space for a result are also safe in signal handlers. The
obstack allocation functions are safe as long as you don't use the same
obstack both inside and outside of a signal handler.
That's very outdated because blocking signals leads to very bad
performance, and all code would suffer from that.
--
Florian Weimer / Red Hat Product Security Team