Update.
authorUlrich Drepper <drepper@redhat.com>
Wed, 6 Feb 2002 00:55:46 +0000 (00:55 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 6 Feb 2002 00:55:46 +0000 (00:55 +0000)
* elf/dl-load.c (_dl_map_object_from_fd): Prevent dynamically
loading modules with the DF_STATIC_TLS flag set.
* elf/dynamic-link.h (elf_get_dynamic_info): Initialize l_flags
element.
* include/link.h (struct link_map): Add l_flags field.
* elf/elf.h (DF_STATIC_TLS): New definition.

ChangeLog
elf/dl-load.c
elf/dynamic-link.h
elf/elf.h
include/link.h

index 7b9f8bb..b5993a2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2002-02-05  Ulrich Drepper  <drepper@redhat.com>
 
+       * elf/dl-load.c (_dl_map_object_from_fd): Prevent dynamically
+       loading modules with the DF_STATIC_TLS flag set.
+       * elf/dynamic-link.h (elf_get_dynamic_info): Initialize l_flags
+       element.
+       * include/link.h (struct link_map): Add l_flags field.
+       * elf/elf.h (DF_STATIC_TLS): New definition.
+
        * dlfcn/Makefile: Add rules to build and run bug-dlopen1.
        * dlfcn/bug-dlopen1.c: New file.  By Bruno Haible.
 
index a4e2421..6f9ce05 100644 (file)
@@ -1170,7 +1170,11 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
 
   /* Make sure we are dlopen()ing an object which has the DF_1_NOOPEN
      flag set.  */
-  if (__builtin_expect (l->l_flags_1 & DF_1_NOOPEN, 0)
+  if ((__builtin_expect (l->l_flags_1 & DF_1_NOOPEN, 0)
+#ifdef USE_TLS
+       || __builtin_expect (l->l_flags & DF_STATIC_TLS, 0)
+#endif
+       )
       && (mode & __RTLD_DLOPEN))
     {
       /* We are not supposed to load this object.  Free all resources.  */
index f352997..0229684 100644 (file)
@@ -117,12 +117,12 @@ elf_get_dynamic_info (struct link_map *l)
       /* Flags are used.  Translate to the old form where available.
         Since these l_info entries are only tested for NULL pointers it
         is ok if they point to the DT_FLAGS entry.  */
-      ElfW(Word) flags = info[DT_FLAGS]->d_un.d_val;
-      if (flags & DF_SYMBOLIC)
+      l->l_flags = info[DT_FLAGS]->d_un.d_val;
+      if l->l_(flags & DF_SYMBOLIC)
        info[DT_SYMBOLIC] = info[DT_FLAGS];
-      if (flags & DF_TEXTREL)
+      if l->l_(flags & DF_TEXTREL)
        info[DT_TEXTREL] = info[DT_FLAGS];
-      if (flags & DF_BIND_NOW)
+      if (l->l_flags & DF_BIND_NOW)
        info[DT_BIND_NOW] = info[DT_FLAGS];
     }
 #endif
index d333b4e..f43fbf8 100644 (file)
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -730,6 +730,7 @@ typedef struct
 #define DF_SYMBOLIC    0x00000002      /* Symbol resolutions starts here */
 #define DF_TEXTREL     0x00000004      /* Object contains text relocations */
 #define DF_BIND_NOW    0x00000008      /* No lazy binding for this object */
+#define DF_STATIC_TLS  0x00000010      /* Module uses the static TLS model */
 
 /* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1
    entry in the dynamic section.  */
index 5502bbf..0bb244d 100644 (file)
@@ -237,6 +237,7 @@ struct link_map
     /* Various flag words.  */
     ElfW(Word) l_feature_1;
     ElfW(Word) l_flags_1;
+    ElfW(Word) l_flags;
 
     /* Temporarily used in `dl_close'.  */
     unsigned int l_idx;