This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] Race in dl code: dl_open_worker and _dl_fini
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Sripathi Kodi <sripathik at in dot ibm dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Fri, 13 Apr 2007 18:26:05 +0200
- Subject: Re: [PATCH] Race in dl code: dl_open_worker and _dl_fini
- References: <20061222081928.GA11656@in.ibm.com> <20061225053426.GA8174@in.ibm.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Dec 25, 2006 at 11:04:26AM +0530, Sripathi Kodi wrote:
> I have attached a patch to this mail that implements the second solution
> I have explained below. I have added a flag l_fini_called to link_map
> structure and I have used that flag in _dl_fini to ensure the
> destructors are called only once.
> Please let me know if either of these two approaches is acceptable.
Using a bit-field for this has issues (but so did the old code).
As that part of _dl_fini is executed without dl_load_lock, some other
thread modifying any of the bit-fields in the same word might race
with it. Similarly --l->l_direct_opencount is unsafe, wonder if
we need that at all, the app is going to exit anyway.
The more important question is, what is supposed to happen when
calling functions from a library whose destructors have been run already.