about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-02-06 00:55:46 +0000
committerUlrich Drepper <drepper@redhat.com>2002-02-06 00:55:46 +0000
commitec70c011557d0964dfc528d2d326d75526aec123 (patch)
treeca3440c580f185559c2d0508f968f27ee1630b45 /elf
parent472d82fc06664bea2859cb94b4469c48af2d10d1 (diff)
downloadglibc-ec70c011557d0964dfc528d2d326d75526aec123.tar.gz
glibc-ec70c011557d0964dfc528d2d326d75526aec123.tar.xz
glibc-ec70c011557d0964dfc528d2d326d75526aec123.zip
Update.
	* 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.
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-load.c6
-rw-r--r--elf/dynamic-link.h8
-rw-r--r--elf/elf.h1
3 files changed, 10 insertions, 5 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index a4e2421b6c..6f9ce05d46 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -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.  */
diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
index f3529970a1..0229684009 100644
--- a/elf/dynamic-link.h
+++ b/elf/dynamic-link.h
@@ -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
diff --git a/elf/elf.h b/elf/elf.h
index d333b4e003..f43fbf8d22 100644
--- 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.  */