Author: kib
Date: Wed Apr 29 10:54:58 2020
New Revision: 360456
URL: https://svnweb.freebsd.org/changeset/base/360456

Log:
  MFC r360201:
  rtld: ignore static TLS segments when tracing.

Modified:
  stable/12/libexec/rtld-elf/rtld.c
  stable/12/libexec/rtld-elf/rtld.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/libexec/rtld-elf/rtld.c
==============================================================================
--- stable/12/libexec/rtld-elf/rtld.c   Wed Apr 29 10:53:35 2020        
(r360455)
+++ stable/12/libexec/rtld-elf/rtld.c   Wed Apr 29 10:54:58 2020        
(r360456)
@@ -3320,7 +3320,7 @@ rtld_dlopen(const char *name, int fd, int mode)
     if (mode & RTLD_NOLOAD)
            lo_flags |= RTLD_LO_NOLOAD;
     if (ld_tracing != NULL)
-           lo_flags |= RTLD_LO_TRACE;
+           lo_flags |= RTLD_LO_TRACE | RTLD_LO_IGNSTLS;
 
     return (dlopen_object(name, fd, obj_main, lo_flags,
       mode & (RTLD_MODEMASK | RTLD_GLOBAL), NULL));
@@ -3371,15 +3371,15 @@ dlopen_object(const char *name, int fd, Obj_Entry *ref
            /* We loaded something new. */
            assert(globallist_next(old_obj_tail) == obj);
            result = 0;
-           if ((lo_flags & RTLD_LO_EARLY) == 0 && obj->static_tls &&
-             !allocate_tls_offset(obj)) {
+           if ((lo_flags & (RTLD_LO_EARLY | RTLD_LO_IGNSTLS)) == 0 &&
+             obj->static_tls && !allocate_tls_offset(obj)) {
                _rtld_error("%s: No space available "
                  "for static Thread Local Storage", obj->path);
                result = -1;
            }
            if (result != -1)
                result = load_needed_objects(obj, lo_flags & (RTLD_LO_DLOPEN |
-                   RTLD_LO_EARLY));
+                   RTLD_LO_EARLY | RTLD_LO_IGNSTLS));
            init_dag(obj);
            ref_dag(obj);
            if (result != -1)

Modified: stable/12/libexec/rtld-elf/rtld.h
==============================================================================
--- stable/12/libexec/rtld-elf/rtld.h   Wed Apr 29 10:53:35 2020        
(r360455)
+++ stable/12/libexec/rtld-elf/rtld.h   Wed Apr 29 10:54:58 2020        
(r360456)
@@ -309,6 +309,7 @@ TAILQ_HEAD(obj_entry_q, Struct_Obj_Entry);
 #define        RTLD_LO_FILTEES 0x10    /* Loading filtee. */
 #define        RTLD_LO_EARLY   0x20    /* Do not call ctors, postpone it to the
                                   initialization during the image start. */
+#define        RTLD_LO_IGNSTLS 0x40    /* Do not allocate static TLS */
 
 /*
  * Symbol cache entry used during relocation to avoid multiple lookups
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to