This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Calling other functions while concurrently calling exit?
- From: Rich Felker <dalias at aerifal dot cx>
- To: Andreas Schwab <schwab at linux-m68k dot org>
- Cc: Carlos O'Donell <carlos at redhat dot com>, GNU C Library <libc-alpha at sourceware dot org>, Torvald Riegel <triegel at redhat dot com>
- Date: Sat, 19 Sep 2015 10:31:40 -0400
- Subject: Re: Calling other functions while concurrently calling exit?
- Authentication-results: sourceware.org; auth=none
- References: <55FCD13B dot 8030000 at redhat dot com> <87fv2aoqfe dot fsf at igel dot home>
On Sat, Sep 19, 2015 at 08:48:21AM +0200, Andreas Schwab wrote:
> "Carlos O'Donell" <carlos@redhat.com> writes:
>
> > Is it spelled out anywhere in POSIX or ISO C that calling
> > other functions concurrently with exit is going to result
> > in undefined behaviour?
>
> exit must be thread-safe, except that calling it more than once is
> undefined.
Indeed, exit must be thread-safe. glibc has a long history of doing
this wrong (omitting necessary locking), including failure to lock
stdio files when accessing them during exit. This is all unsafe and
needs to be fixed, but some of the fixes will impact applications in
ways users will not be happy with. See this report we got against musl
(which follows the standard):
http://www.openwall.com/lists/musl/2015/08/12/2
The relevant POSIX issue that clarified this is:
http://austingroupbugs.net/view.php?id=611
Rich