glibc/glibc-rh2233338-3.patch

31 lines
1.1 KiB
Diff
Raw Normal View History

commit f6c8204fd7fabf0cf4162eaf10ccf23258e4d10e
Author: Florian Weimer <fweimer@redhat.com>
Date: Tue Aug 22 13:56:25 2023 +0200
elf: Do not run constructors for proxy objects
Otherwise, the ld.so constructor runs for each audit namespace
and each dlmopen namespace.
diff --git a/elf/dl-init.c b/elf/dl-init.c
index 99ce531d7b326f5f..73c0259fbe6d19af 100644
--- a/elf/dl-init.c
+++ b/elf/dl-init.c
@@ -28,10 +28,14 @@ typedef void (*init_t) (int, char **, char **);
static void
call_init (struct link_map *l, int argc, char **argv, char **env)
{
+ /* Do not run constructors for proxy objects. */
+ if (l != l->l_real)
+ return;
+
/* If the object has not been relocated, this is a bug. The
function pointers are invalid in this case. (Executables do not
- need relocation, and neither do proxy objects.) */
- assert (l->l_real->l_relocated || l->l_real->l_type == lt_executable);
+ need relocation.) */
+ assert (l->l_relocated || l->l_type == lt_executable);
if (l->l_init_called)
/* This object is all done. */