NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/48324: ld.elf_so - tty.c memcpy overwrites tcb for tls variant 2
The following reply was made to PR lib/48324; it has been noted by GNATS.
From: Nat Sloss <nathanialsloss%yahoo.com.au@localhost>
To: Nick Hudson <nick.hudson%gmx.co.uk@localhost>
Cc: gnats-bugs%netbsd.org@localhost
Subject: Re: lib/48324: ld.elf_so - tty.c memcpy overwrites tcb for tls variant
2
Date: Sun, 20 Oct 2013 07:53:57 +1100
On Sun, 20 October 2013 02:45:38 you wrote:
> On 19/10/2013 13:58, Nat Sloss i wrote:
> > obj 0xb3877800 dtv 0xb82e5a40 tlsoffset 0
>
> A tlsoffset of 0 is wrong. Looks like we're missing a call to
> _rtld_tls_offset_allocate somewhere.
>
> Nick
I have found using gdb that obj->tls_done = 0. This was found whilst in
rtld_allocate_locked.
Should tls storage have been initialized previously for libmpfr. ldd on the
program makes no reference to libmpfr, its a dependency for one of the
libraries which is listed by ldd libsoprano.
If tls storage is not initialized may we initialize it during allocation. ie:
Index: ld.elf_so/tls.c
===================================================================
RCS file: /cvsroot/src/libexec/ld.elf_so/tls.c,v
retrieving revision 1.8
diff -u -r1.8 tls.c
--- ld.elf_so/tls.c 19 Oct 2013 10:14:06 -0000 1.8
+++ ld.elf_so/tls.c 19 Oct 2013 21:18:26 -0000
@@ -141,6 +141,11 @@
SET_DTV_GENERATION(tcb->tcb_dtv, _rtld_tls_dtv_generation);
for (obj = _rtld_objlist; obj != NULL; obj = obj->next) {
+ if (obj->tls_done == 0) {
+ if (rtld_tls_offset_allocate(obj) < 0)
+ continue;
+ }
+
if (obj->tlssize) {
#ifdef __HAVE_TLS_VARIANT_I
q = p + obj->tlsoffset;
I don't know if it was a good idea to skip tls modules that could not be
initialized.
Regards,
Nat.
Home |
Main Index |
Thread Index |
Old Index