This is the mail archive of the
libc-help@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: "Mike Frysinger" <vapier at gentoo dot org>, libc-help at sourceware dot org, suzuki at in dot ibm dot com
- Date: Tue, 10 Jun 2008 09:16:36 -0400
- Subject: Re: [PATCH] Fix the race between atexit() and exit()
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=RbNLDAzQioqQAVWgRnpd6wxfMY6huIPPw6GWez0tSIc=; b=HbH+73qSuUxue0lTXya7a/9eFiUeZWWT9A/vsLQoIzCxpzV5yGF9YGyqBNeIplAgX+ k3Bxcu/gne/T7ZtL544OOhVRINd9aYPV/BOj0jy2skb31CgwW5cUZsIx2EWFIaltgXz7 5ZsBizudr3jCosjMWtwI9/Yo4pzhNlwEuEc/k=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=gxd2mJ4Mc72Zf+tN9FWyyjKu8U3Tcj+8zdOxRnAHEf6Dg7QtgwN3Ork97+vRyihKb6 jqJyjAq5IBdzXVhTHQRuhrxaW2gPNOVu2yq32rUo/+PebpMYrBrJieg5Vn9QxKMAvWmx IDUfwK6K0eGPU7GqjlOUmJFEPMotBb6Rex3jA=
- References: <20080603122353.401tp2lfk00cgso0@imap.linux.ibm.com> <119aab440806040654r28f73e29v406655662c2038a7@mail.gmail.com> <48478842.3040904@linux.vnet.ibm.com> <200806050540.03153.vapier@gentoo.org> <119aab440806050448j380549f3o938a9c0af91026e9@mail.gmail.com> <484E72AB.3020809@linux.vnet.ibm.com>
On Tue, Jun 10, 2008 at 8:25 AM, Anoop <acv@linux.vnet.ibm.com> wrote:
> Please see https://www.opengroup.org/austin/mailarchives/ag/ for the
> discussions that happened
> on the opengroup list.
Interesting discussion.
> The result of this discussion as I would infer is that exit() and atexit()
> need to be safe with each other in the matter of keeping the list
> consistent.
> But it CAN'T be guaranteed that, if atexit() is called, 'during or after'
> exit() is called,
> from a different thread, the handler that atexit() tries to register will be
> invoked by exit().
I agree.
> The proposed patch does 2 things -
> 1. Keeps the list in a consistent state by protecting it with lock
> 2. Fails the atexit() registrations after exit() finishes processing the
> list.
That sounds reasonable.
> Accommodating as many handlers as possible is the important and right thing
> to do. But you cant
> avoid the "visibility problem" where a new list head appears only after
> exit() processing is over.
> This problem should be taken care of, more by an application programmer than
> by glibc.
> Making the registration fail may not be of any worth as the thread might not
> get a chance to take
> any action afterwards, but from glibc perspective this is just for the sake
> of keeping with the standard.
Where's the patch?
Cheers,
Carlos.