aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--elf/dl-open.c6
-rw-r--r--elf/tst-dlmopen3.c23
-rw-r--r--include/resolv.h3
-rw-r--r--resolv/res_data.c3
-rw-r--r--resolv/res_debug.c11
-rw-r--r--resolv/res_mkquery.c2
7 files changed, 56 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 9c52aeb..3c9ae36 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
+2004-10-27 Jakub Jelinek <jakub@redhat.com>
+
+ * include/resolv.h (_res_opcodes): New extern.
+ Add libresolv_hidden_proto.
+ * resolv/res_debug.c (_res_opcodes): Remove.
+ (__p_class_syms, __p_type_syms): Add libresolv_hidden_proto
+ and libresolv_hidden_data_def. Remove attribute_hidden.
+ * resolv/res_mkquery (_res_opcodes): Remove.
+ * resolv/res_data.c (_res_opcodes): Remove attribute_hidden.
+ Add libresolv_hidden_data_def.
+
2004-10-27 Ulrich Drepper <drepper@redhat.com>
+ * elf/dl-open.c (_dl_open): Don't allow explicitly opening a DSO
+ into an empty namespace.
+
* elf/dl-fini.c (_dl_fini): Fix search for map in maps array.
Reverse order of namespaces.
* elf/Makefile: Add rules to build and run tst-dlmopen3.
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 2ab1e30..294a523 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -570,6 +570,12 @@ _dl_open (const char *file, int mode, const void *caller_dlopen, Lmid_t nsid)
no more namespaces available for dlmopen()"));
}
}
+ /* Never allow loading a DSO in a namespace which is empty. Such
+ direct placements is only causing problems. */
+ else if (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER
+ && GL(dl_ns)[nsid]._ns_nloaded == 0)
+ GLRO(dl_signal_error) (EINVAL, file, NULL,
+ N_("invalid target namespace in dlmopen()"));
args.file = file;
args.mode = mode;
diff --git a/elf/tst-dlmopen3.c b/elf/tst-dlmopen3.c
new file mode 100644
index 0000000..da951ca
--- /dev/null
+++ b/elf/tst-dlmopen3.c
@@ -0,0 +1,23 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <gnu/lib-names.h>
+
+
+static int
+do_test (void)
+{
+ void *h = dlmopen (LM_ID_NEWLM, "$ORIGIN/tst-dlmopen1mod.so", RTLD_LAZY);
+ if (h == NULL)
+ {
+ printf ("cannot get handle for %s: %s\n",
+ "tst-dlmopen1mod.so", dlerror ());
+ return 1;
+ }
+
+ /* Do not unload. */
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/include/resolv.h b/include/resolv.h
index 6f1c343..9c24bd3 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -98,6 +98,9 @@ libresolv_hidden_proto (__ns_name_unpack)
libresolv_hidden_proto (__ns_get16)
libresolv_hidden_proto (__ns_get32)
+extern const char *_res_opcodes[];
+libresolv_hidden_proto (_res_opcodes)
+
#endif
#endif
diff --git a/resolv/res_data.c b/resolv/res_data.c
index 438f815..adadcdc 100644
--- a/resolv/res_data.c
+++ b/resolv/res_data.c
@@ -39,7 +39,7 @@ static const char rcsid[] = "$BINDId: res_data.c,v 8.17 1999/10/13 17:11:31 vixi
#include <string.h>
#include <unistd.h>
-const char *_res_opcodes[] attribute_hidden = {
+const char *_res_opcodes[] = {
"QUERY",
"IQUERY",
"CQUERYM",
@@ -57,6 +57,7 @@ const char *_res_opcodes[] attribute_hidden = {
"ZONEINIT",
"ZONEREF",
};
+libresolv_hidden_data_def (_res_opcodes)
#ifdef BIND_UPDATE
const char *_res_sectioncodes[] attribute_hidden = {
diff --git a/resolv/res_debug.c b/resolv/res_debug.c
index 6b719d1..839069d 100644
--- a/resolv/res_debug.c
+++ b/resolv/res_debug.c
@@ -118,7 +118,6 @@ static const char rcsid[] = "$BINDId: res_debug.c,v 8.34 2000/02/29 05:30:55 vix
# define SPRINTF(x) sprintf x
#endif
-extern const char *_res_opcodes[] attribute_hidden;
extern const char *_res_sectioncodes[] attribute_hidden;
/*
@@ -349,7 +348,9 @@ p_fqname(const u_char *cp, const u_char *msg, FILE *file) {
* that C_ANY is a qclass but not a class. (You can ask for records of class
* C_ANY, but you can't have any records of that class in the database.)
*/
-const struct res_sym __p_class_syms[] attribute_hidden = {
+extern const struct res_sym __p_class_syms[];
+libresolv_hidden_proto (__p_class_syms)
+const struct res_sym __p_class_syms[] = {
{C_IN, "IN"},
{C_CHAOS, "CHAOS"},
{C_HS, "HS"},
@@ -358,6 +359,7 @@ const struct res_sym __p_class_syms[] attribute_hidden = {
{C_NONE, "NONE"},
{C_IN, (char *)0}
};
+libresolv_hidden_data_def (__p_class_syms)
/*
* Names of message sections.
@@ -401,7 +403,9 @@ const struct res_sym __p_cert_syms[] attribute_hidden = {
* that T_ANY is a qtype but not a type. (You can ask for records of type
* T_ANY, but you can't have any records of that type in the database.)
*/
-const struct res_sym __p_type_syms[] attribute_hidden = {
+extern const struct res_sym __p_type_syms[];
+libresolv_hidden_proto (__p_type_syms)
+const struct res_sym __p_type_syms[] = {
{ns_t_a, "A", "address"},
{ns_t_ns, "NS", "name server"},
{ns_t_md, "MD", "mail destination (deprecated)"},
@@ -448,6 +452,7 @@ const struct res_sym __p_type_syms[] attribute_hidden = {
{ns_t_any, "ANY", "\"any\""},
{0, NULL, NULL}
};
+libresolv_hidden_data_def (__p_type_syms)
/*
* Names of DNS rcodes.
diff --git a/resolv/res_mkquery.c b/resolv/res_mkquery.c
index 875d495..815fcf8 100644
--- a/resolv/res_mkquery.c
+++ b/resolv/res_mkquery.c
@@ -88,8 +88,6 @@ static const char rcsid[] = "$BINDId: res_mkquery.c,v 8.12 1999/10/13 16:39:40 v
# endif
#endif
-extern const char *_res_opcodes[];
-
/*
* Form all types of queries.
* Returns the size of the result or -1.