[PATCH] Don't close or flush stdio streams on abort

Rich Felker dalias@aerifal.cx
Wed May 8 17:23:00 GMT 2013


On Wed, May 08, 2013 at 02:02:56PM +0200, Andreas Schwab wrote:
> Ondřej Bílka <neleai@seznam.cz> writes:
> 
> > However removal at stage 4 could cause debugging info not be displayed.
> > Could it be possible to ignore delivery with something like sigprocmask?
> 
> Ignore what delivery?

Ondřej seems to be confused that async-signal-safety has to do with
arrival of a signal while abort() is in progress, rather than calling
abort() from a signal handler, possibly while the locks are held.

With the right types of locks, a trylock operation could be performed
instead of waiting for a lock. This requires an async-signal-safe,
reentrant, recursive mutex. We have them in musl but I don't know if
glibc uses a type of lock that could easily be made reentrant. (The
key trick we use is that, when the lock is held, the reference count
is one less than the actual number of references, so that there's no
race window between taking the lock and setting count to 1.)

Rich



More information about the Libc-alpha mailing list