]> git.ipfire.org Git - thirdparty/glibc.git/commit
elf: Call __libc_early_init for reused namespaces (bug 29528)
authorFlorian Weimer <fweimer@redhat.com>
Fri, 26 Aug 2022 19:15:43 +0000 (21:15 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 30 Aug 2022 14:31:03 +0000 (16:31 +0200)
commit924e4f3eaa502ce82fccf8537f021a796d158771
tree6918e25d51a6554894f760b1d224c82290dabc7f
parentb0e7888d1fa2dbd2d9e1645ec8c796abf78880b9
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.

(cherry picked from commit d0e357ff45a75553dee3b17ed7d303bfa544f6fe)
NEWS
elf/Makefile
elf/dl-open.c
elf/tst-dlmopen-twice-mod1.c [new file with mode: 0644]
elf/tst-dlmopen-twice-mod2.c [new file with mode: 0644]
elf/tst-dlmopen-twice.c [new file with mode: 0644]