This is the mail archive of the libc-alpha@sourceware.org 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]

Re: [patch] initialize bootstrap_map.l_tls_modid


On Fri, Sep 29, 2006 at 07:50:21AM -0300, Rafael Esp?ndola wrote:
> Running some tests on qemu I sometimes hit the assertion
> 
> _dl_start_final: Assertion `info->l.l_tls_modid == 0'
> 
> I initially thought that it was a bug in qemu, but investigating
> further showed that  bootstrap_map.l_tls_modid was stack allocated but
> not initialized.
> 
> The attached patch initializes it to 0. The bug is a bit hard to
> reproduce, but it can be done by initializing l_tls_modid to another
> value.

I'd prefer not to waste runtime cycles just so that something can
be asserted.  If !USE___THREAD in rtld.c (currently always), then we really
don't need it for anything in bootstrap_map (and it is already zero
initialized in GL(dl_rtld_map)).

2006-09-29  Jakub Jelinek  <jakub@redhat.com>

	* elf/rtld.c (_dl_start_final): If not USE___THREAD, don't
	assert bootstrap_map.l_tls_modid is zero.
	(_dl_start): Initialize bootstrap_map.l_tls_modid to 0
	if USE___THREAD.

--- libc/elf/rtld.c.jj	2006-06-21 17:36:37.000000000 +0200
+++ libc/elf/rtld.c	2006-09-29 14:02:39.000000000 +0200
@@ -303,7 +303,6 @@ _dl_start_final (void *arg, struct dl_st
   GL(dl_rtld_map).l_tls_offset = info->l.l_tls_offset;
   GL(dl_rtld_map).l_tls_modid = 1;
 # else
-  assert (info->l.l_tls_modid == 0);
 #  if NO_TLS_OFFSET != 0
   GL(dl_rtld_map).l_tls_offset = NO_TLS_OFFSET;
 #  endif
@@ -389,6 +388,9 @@ _dl_start (void *arg)
        ++cnt)
     bootstrap_map.l_info[cnt] = 0;
 # endif
+# if USE___THREAD
+  bootstrap_map.l_tls_modid = 0;
+# endif
 #endif
 
   /* Figure out the run-time load address of the dynamic linker itself.  */

	Jakub


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