[PATCH] _dl_close fix
Jakub Jelinek
jakub@redhat.com
Thu Oct 5 05:27:00 GMT 2000
Hi!
I'm getting segfaults in __deregister_frame_info in the attached testcase.
The issue is that on dlclose(finimod1) in main, in _dl_close
finimod1's map l_initfini[0] == list[0] == finimod1, but l_initfini[1] = finimod2 while
list[1] == pthread, l_initfini[2] == pthread while list[2] == finimod2
pthread has the DF_1_NODELETE flag set, so during dlclose() we call
finimod1's FINI, skip calling finimod2's FINI and call pthread's FINI (it is
DF_1_NODELETE, so we should not).
This patch seems to fix it.
Thanks to Bill Nottingham who worked on this as well.
2000-10-05 Jakub Jelinek <jakub@redhat.com>
* elf/dl-close.c (_dl_close): Check imap's l_flags_1 for
DF_1_NODELETE, not list[i]'s.
--- libc/elf/dl-close.c.jj Fri Sep 29 12:56:56 2000
+++ libc/elf/dl-close.c Thu Oct 5 13:53:34 2000
@@ -95,7 +95,7 @@ _dl_close (void *_map)
struct link_map *imap = map->l_initfini[i];
if (imap->l_opencount == 1 && imap->l_type == lt_loaded
&& (imap->l_info[DT_FINI] || imap->l_info[DT_FINI_ARRAY])
- && ! (list[i]->l_flags_1 & DF_1_NODELETE)
+ && ! (imap->l_flags_1 & DF_1_NODELETE)
/* Skip any half-cooked objects that were never initialized. */
&& imap->l_init_called)
{
Jakub
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fini.tar.bz2
Type: application/x-bzip2
Size: 535 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-hacker/attachments/20001005/e4dfcb29/attachment.bz2>
More information about the Libc-hacker
mailing list