This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix the race between atexit() and exit()
- From: "Carlos O'Donell" <carlos at systemhalted dot org>
- To: Anoop <acv at linux dot vnet dot ibm dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 3 Jun 2008 08:37:05 -0400
- Subject: Re: [PATCH] Fix the race between atexit() and exit()
- References: <48453437.9050304@linux.vnet.ibm.com>
On Tue, Jun 3, 2008 at 8:08 AM, Anoop <acv@linux.vnet.ibm.com> wrote:
> POSIX requires that at normal program termination, all functions
> registered by the atexit() function shall be called. A race exits among
> __cxa_atexit() and exit() on __exit_funcs can cause a successfully
> registered handler not to be called. I have a test-case which reveals this
> bug, which can be posted if required. The following patch solves this by
> extending the locking
> used by __new_exitfn() to exit() and failing atexit() registrations once the
> exit() code completed traversing the __exit_funcs list.
>
> Feedbacks appreciated.
1. Describe in detail the conditions of the race and your proposed fix.
2. Provide the test case.
3. Run the testsuite for your target to show there were no
regressions. Mention the target.
4. When quoting POSIX please provide references.
Cheers,
Carlos.