about summary refs log tree commit diff
path: root/dlfcn/moddummy1.c
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos@systemhalted.org>2015-01-21 01:51:10 -0500
committerCarlos O'Donell <carlos@systemhalted.org>2015-01-21 01:51:10 -0500
commitccdb048df457d581f6ac7ede8b0c7a593a891dfa (patch)
tree9f87447c45093fb2ded95c982e68c9e6e886129c /dlfcn/moddummy1.c
parent042e1521c794a945edc43b5bfa7e69ad70420524 (diff)
downloadglibc-ccdb048df457d581f6ac7ede8b0c7a593a891dfa.tar.gz
glibc-ccdb048df457d581f6ac7ede8b0c7a593a891dfa.tar.xz
glibc-ccdb048df457d581f6ac7ede8b0c7a593a891dfa.zip
Fix recursive dlopen.
The ability to recursively call dlopen is useful for malloc
implementations that wish to load other dynamic modules that
implement reentrant/AS-safe functions to use in their own
implementation.

Given that a user malloc implementation may be called by an
ongoing dlopen to allocate memory the user malloc
implementation interrupts dlopen and if it calls dlopen again
that's a reentrant call.

This patch fixes the issues with the ld.so.cache mapping
and the _r_debug assertion which prevent this from working
as expected.

See:
https://sourceware.org/ml/libc-alpha/2014-12/msg00446.html
Diffstat (limited to 'dlfcn/moddummy1.c')
-rw-r--r--dlfcn/moddummy1.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/dlfcn/moddummy1.c b/dlfcn/moddummy1.c
new file mode 100644
index 0000000000..6e549fa7d2
--- /dev/null
+++ b/dlfcn/moddummy1.c
@@ -0,0 +1,10 @@
+/* Provide a dummy DSO for tst-rec-dlopen to use.  */
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+dummy1 (void)
+{
+  printf ("Called dummy1()\n");
+  return 1;
+}