This is the mail archive of the
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: <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <484E72AB.email@example.com>
On Tue, Jun 10, 2008 at 8:25 AM, Anoop <firstname.lastname@example.org> wrote:
> Please see https://www.opengroup.org/austin/mailarchives/ag/ for the
> discussions that happened
> on the opengroup list.
> 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
> 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().
> 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
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?