This is the mail archive of the mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] _dl_close fix


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  <>

	* 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)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]