From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id BB6753858D28; Tue, 22 Aug 2023 11:58:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB6753858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1692705488; bh=EbP4lsjorAJWc5VZtUl8sDMzhf0/bp8EOf/sFmue2xg=; h=From:To:Subject:Date:From; b=YwJlIS3bVbwNV13PBlYzH3E6O+YP6LyfUE6w3w5dleSxCeV8kcEYjGZbzzz5wAwE9 I5+OCJsnGvfFWIur9BrKb7KxhuNInMcRI8CSKScdVtOh/A13FzCmoaUUJLHvC7Y7cQ 12wj8sbbPd9/qdwX3cIcUovmwoxVXPBj1lJKsYBg= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc] elf: Do not run constructors for proxy objects X-Act-Checkin: glibc X-Git-Author: Florian Weimer X-Git-Refname: refs/heads/master X-Git-Oldrev: a8ecb126d4c26c52f4ad828c566afe4043a28155 X-Git-Newrev: f6c8204fd7fabf0cf4162eaf10ccf23258e4d10e Message-Id: <20230822115808.BB6753858D28@sourceware.org> Date: Tue, 22 Aug 2023 11:58:08 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f6c8204fd7fabf0cf4162eaf10ccf23258e4d10e commit f6c8204fd7fabf0cf4162eaf10ccf23258e4d10e Author: Florian Weimer 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: --- elf/dl-init.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/elf/dl-init.c b/elf/dl-init.c index 5b0732590f..ba4d2fdc85 100644 --- a/elf/dl-init.c +++ b/elf/dl-init.c @@ -25,10 +25,14 @@ 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. */