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.
/* 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. */
/* 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
#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. */
/* 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;