about summary refs log tree commit diff
path: root/elf/Makefile
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2022-08-26 21:15:43 +0200
committerFlorian Weimer <fweimer@redhat.com>2022-08-26 21:15:43 +0200
commitd0e357ff45a75553dee3b17ed7d303bfa544f6fe (patch)
tree1b3480f556a5a7d109c3cc5775ed951420156f00 /elf/Makefile
parent06d4381dd81eaab16b538017adc5854033f44b6d (diff)
downloadglibc-d0e357ff45a75553dee3b17ed7d303bfa544f6fe.tar.gz
glibc-d0e357ff45a75553dee3b17ed7d303bfa544f6fe.tar.xz
glibc-d0e357ff45a75553dee3b17ed7d303bfa544f6fe.zip
elf: Call __libc_early_init for reused namespaces (bug 29528)
libc_map is never reset to NULL, neither during dlclose nor on a
dlopen call which reuses the namespace structure.  As a result, if a
namespace is reused, its libc is not initialized properly.  The most
visible result is a crash in the <ctype.h> functions.

To prevent similar bugs on namespace reuse from surfacing,
unconditionally initialize the chosen namespace to zero using memset.
Diffstat (limited to 'elf/Makefile')
-rw-r--r--elf/Makefile7
1 files changed, 7 insertions, 0 deletions
diff --git a/elf/Makefile b/elf/Makefile
index 3928a08787..008770bfaf 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -410,6 +410,7 @@ tests += \
   tst-dlmopen4 \
   tst-dlmopen-dlerror \
   tst-dlmopen-gethostbyname \
+  tst-dlmopen-twice \
   tst-dlopenfail \
   tst-dlopenfail-2 \
   tst-dlopenrpath \
@@ -839,6 +840,8 @@ modules-names += \
   tst-dlmopen1mod \
   tst-dlmopen-dlerror-mod \
   tst-dlmopen-gethostbyname-mod \
+  tst-dlmopen-twice-mod1 \
+  tst-dlmopen-twice-mod2 \
   tst-dlopenfaillinkmod \
   tst-dlopenfailmod1 \
   tst-dlopenfailmod2 \
@@ -2976,3 +2979,7 @@ $(objpfx)tst-audit-tlsdesc.out: $(objpfx)tst-auditmod-tlsdesc.so
 tst-audit-tlsdesc-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
 $(objpfx)tst-audit-tlsdesc-dlopen.out: $(objpfx)tst-auditmod-tlsdesc.so
 tst-audit-tlsdesc-dlopen-ENV = LD_AUDIT=$(objpfx)tst-auditmod-tlsdesc.so
+
+$(objpfx)tst-dlmopen-twice.out: \
+  $(objpfx)tst-dlmopen-twice-mod1.so \
+  $(objpfx)tst-dlmopen-twice-mod2.so