[PATCH] Race in dl code: dl_open_worker and _dl_fini
Jakub Jelinek
jakub@redhat.com
Fri Apr 13 16:19:00 GMT 2007
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.
Jakub
More information about the Libc-alpha
mailing list