[PATCH] Fix the race between atexit() and exit()

Carlos O'Donell carlos@systemhalted.org
Tue Jun 3 12:53:00 GMT 2008


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.



More information about the Libc-alpha mailing list