Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Only initialise TLS space from the PT_TLS segment, if the si...



details:   https://anonhg.NetBSD.org/src/rev/066f0a7a6f24
branches:  trunk
changeset: 790806:066f0a7a6f24
user:      joerg <joerg%NetBSD.org@localhost>
date:      Mon Oct 21 19:14:15 2013 +0000

description:
Only initialise TLS space from the PT_TLS segment, if the size is
positive and the offset has been computed. Fixes PR lib/48324.

diffstat:

 libexec/ld.elf_so/tls.c               |  6 +++---
 tests/lib/libc/tls/dso/h_tls_dlopen.c |  5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diffs (53 lines):

diff -r f33eee3ba815 -r 066f0a7a6f24 libexec/ld.elf_so/tls.c
--- a/libexec/ld.elf_so/tls.c   Mon Oct 21 19:11:17 2013 +0000
+++ b/libexec/ld.elf_so/tls.c   Mon Oct 21 19:14:15 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tls.c,v 1.8 2013/10/19 10:14:06 skrll Exp $    */
+/*     $NetBSD: tls.c,v 1.9 2013/10/21 19:14:15 joerg Exp $    */
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: tls.c,v 1.8 2013/10/19 10:14:06 skrll Exp $");
+__RCSID("$NetBSD: tls.c,v 1.9 2013/10/21 19:14:15 joerg Exp $");
 
 #include <sys/param.h>
 #include <sys/ucontext.h>
@@ -141,7 +141,7 @@
        SET_DTV_GENERATION(tcb->tcb_dtv, _rtld_tls_dtv_generation);
 
        for (obj = _rtld_objlist; obj != NULL; obj = obj->next) {
-               if (obj->tlssize) {
+               if (obj->tlsinitsize && obj->tls_done) {
 #ifdef __HAVE_TLS_VARIANT_I
                        q = p + obj->tlsoffset;
 #else
diff -r f33eee3ba815 -r 066f0a7a6f24 tests/lib/libc/tls/dso/h_tls_dlopen.c
--- a/tests/lib/libc/tls/dso/h_tls_dlopen.c     Mon Oct 21 19:11:17 2013 +0000
+++ b/tests/lib/libc/tls/dso/h_tls_dlopen.c     Mon Oct 21 19:14:15 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: h_tls_dlopen.c,v 1.4 2012/01/17 20:34:57 joerg Exp $   */
+/*     $NetBSD: h_tls_dlopen.c,v 1.5 2013/10/21 19:14:16 joerg Exp $   */
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: h_tls_dlopen.c,v 1.4 2012/01/17 20:34:57 joerg Exp $");
+__RCSID("$NetBSD: h_tls_dlopen.c,v 1.5 2013/10/21 19:14:16 joerg Exp $");
 
 #include <atf-c.h>
 #include <unistd.h>
@@ -45,6 +45,7 @@
 extern __thread int var1;
 extern __thread int var2;
 extern __thread int *var3;
+__thread int var5 = 1;
 static __thread pid_t (*local_var)(void) = getpid;
 
 void testf_dso_helper(int x, int y);



Home | Main Index | Thread Index | Old Index