From ccdb048df457d581f6ac7ede8b0c7a593a891dfa Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Wed, 21 Jan 2015 01:51:10 -0500 Subject: 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 --- dlfcn/moddummy2.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 dlfcn/moddummy2.c (limited to 'dlfcn/moddummy2.c') diff --git a/dlfcn/moddummy2.c b/dlfcn/moddummy2.c new file mode 100644 index 0000000..cb4edc8 --- /dev/null +++ b/dlfcn/moddummy2.c @@ -0,0 +1,13 @@ +/* Provide a dummy DSO for tst-rec-dlopen to use. */ +#include +#include + +int +dummy2 (void) +{ + printf ("Called dummy2()\n"); + /* If the outer dlopen is not dummy1 (becuase of some error) + then tst-rec-dlopen will see a value of -1 as the returned + result and fail. */ + return -1; +} -- cgit v1.1