This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [patch] initialize bootstrap_map.l_tls_modid
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Rafael Espindola <rafael dot espindola at gmail dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Fri, 29 Sep 2006 14:12:09 +0200
- Subject: Re: [patch] initialize bootstrap_map.l_tls_modid
- References: <564d96fb0609290350t4a81edb3m6acaef56dd347f5a@mail.gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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