This is the mail archive of the libc-alpha@sources.redhat.com 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]

Inconsistency detected by ld.so: ../sysdeps/generic/dl-tls.c: 75:_dl_next_tls_modid: Assertion `result <= _rtld_local._dl_tls_max_dtv_idx'failed!


Hi,

Basically the issue above.  This is valid for glibc 2.3.[234] if I did
not miss anything.  Here is a good test case:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=219352#msg122


I came up with attached patch that seems to work and passes all the
tests (except for the one or two usual ones).  Is this the correct fix,
or are the problem deeper?


Thanks,

-- 
Martin Schlemmer

--- glibc-2.3.4/sysdeps/generic/dl-tls.c.az	2005-03-13 19:26:55.000000000 +0200
+++ glibc-2.3.4/sysdeps/generic/dl-tls.c	2005-03-13 19:29:14.000000000 +0200
@@ -69,7 +69,10 @@
       result = GL(dl_tls_static_nelem) + 1;
       /* If the following would not be true we mustn't have assumed
 	 there is a gap.  */
-      assert (result <= GL(dl_tls_max_dtv_idx));
+      /* The +1 is needed, as we add +1 above, but dl_tls_static_nelem
+         is only once set as far as I can see in dl_main (elf/rtld.c),
+         and that is equal to dl_tls_max_dtv_idx ... */
+      assert (result <= (GL(dl_tls_max_dtv_idx) + 1));
       do
 	{
 	  while (result - disp < runp->len)
@@ -92,7 +95,8 @@
 	{
 	  /* The new index must indeed be exactly one higher than the
 	     previous high.  */
-	  assert (result == GL(dl_tls_max_dtv_idx));
+	  /* Once again +1 for the same reasons as above ... */
+	  assert (result == (GL(dl_tls_max_dtv_idx) + 1));
 
 	  /* There is no gap anymore.  */
 	  GL(dl_tls_dtv_gaps) = false;

Attachment: signature.asc
Description: This is a digitally signed message part


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