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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text] assertion when using a sysinfo DSO

A couple of Debian users reported that running /lib/ didn't work
any more:

drow@nevyn:/opt/src/glibc/libc% /lib/ 
Inconsistency detected by rtld.c: 1175: dl_main: Assertion
`_rtld_local._dl_rtld_map.l_prev->l_next == _rtld_local._dl_rtld_map.l_next'

The problem was that the code for adding an explicitly DT_NEEDED'd
assumed that all visible DSOs would be on the searchlist.  If we have a
sysinfo DSO but nothing explicitly DT_NEEDED'd it, then this assertion does
not hold; if you run (which has the property of a searchlist
containing only two items) then the assert triggers.

I'm using this patch, since I can't think of any other possible pratfalls in
this situation.  Look OK?

Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2003-09-30  Daniel Jacobowitz  <>

	* rtld.c (dl_main): Remove assertion when linking dl_rtld_map
	into the list of visible libraries.

Index: rtld.c
RCS file: /big/fsf/rsync/glibc-cvs/libc/elf/rtld.c,v
retrieving revision 1.293
diff -u -p -r1.293 rtld.c
--- rtld.c	24 Sep 2003 01:55:51 -0000	1.293
+++ rtld.c	30 Sep 2003 14:25:50 -0000
@@ -1223,19 +1223,7 @@ of this helper program; chances are you 
       while (GL(dl_loaded)->l_searchlist.r_list[i] != &GL(dl_rtld_map))
       GL(dl_rtld_map).l_prev = GL(dl_loaded)->l_searchlist.r_list[i - 1];
-      if (__builtin_expect (mode, normal) == normal)
-	GL(dl_rtld_map).l_next = (i + 1 < GL(dl_loaded)->l_searchlist.r_nlist
-				  ? GL(dl_loaded)->l_searchlist.r_list[i + 1]
-				  : NULL);
-      else
-	/* In trace mode there might be an invisible object (which we
-	   could not find) after the previous one in the search list.
-	   In this case it doesn't matter much where we put the
-	   interpreter object, so we just initialize the list pointer so
-	   that the assertion below holds.  */
-	GL(dl_rtld_map).l_next = GL(dl_rtld_map).l_prev->l_next;
-      assert (GL(dl_rtld_map).l_prev->l_next == GL(dl_rtld_map).l_next);
+      GL(dl_rtld_map).l_next = GL(dl_rtld_map).l_prev->l_next;
       GL(dl_rtld_map).l_prev->l_next = &GL(dl_rtld_map);
       if (GL(dl_rtld_map).l_next != NULL)

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