From nobody Sun Jul 30 00:29:51 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RD2M33ymcz4dNgD; Sun, 30 Jul 2023 00:29:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RD2M33B0Mz464G; Sun, 30 Jul 2023 00:29:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690676991; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wjUkZRVQaYlb/vbjKIuHJwC0nJonE6iPuUe0Rv06FYc=; b=hASzo3ASYcpi4mxV32ITN1xEhR3Eg/4j2wlE6Ro42N+1eOMzXiKDXSiORjyHneEk5U2eQA c+x7EejQcwbIbL4FWI7VfICx3PBjvGatAqYoj9l9suT7yUKrpNCQ0XHqHD58IHb9WxlWVv i4LR0eABF0nQB0tTUpkg6kMiNIjqD1U6GujA+K6NnosdhPUQu8kylmw1zJCOsq+YmAzyzu SWkZ6SRF5MmC93xCFJDPV3APoKv6LwwwteoLDfB3AFjjbHto/hPs3JdNZamC3jT1XVWn6A DF1LuFcEOW7+GE9KoqO7EFAOxJ4KfmDCcJZ3GK8x9PI/O0D2plygrbfETh+GMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690676991; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wjUkZRVQaYlb/vbjKIuHJwC0nJonE6iPuUe0Rv06FYc=; b=MMPJwnZb46FC74x6x1lvs0EHDh/6R8F5zXGTJwKlya1IilDtQFDOOljLjw0D3ZNWiMWgxi lGDbNVd93sbCRPHu/k+SG1nEupZR3eeDHp9xbceMd2Oxuc+Ru99MoWZwAWrH3siWz7n9EI xeFWOMgnP6tyNupktWE/yo7MUMx3peHVK3RXFu6GhAtQJvcsuv+XD6gW2PUmx3sejnOvf9 kN22TI6fE7JrNK9HdvrViPDEIXI2A2gDZdMfzqR3bXXk+oqYM+TlpEsaWMDYskx0qlrPEt uqbruyua+IMhL7CydFk9nsZQtT3j9suSEVT7fMiDfgiLEINE9E6kGY68Qxv4QQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1690676991; a=rsa-sha256; cv=none; b=OigqaxLzO13bSCJMlHI1I/aQ8olNUKguLa0ofnHIWb6RO+uIzgl9EiRSos10aanfjVNu+0 VVUWO5pMrBJ6ycvucFMILZ7DDr+SYRwxr0SXUP2/f4Nqo9piTANjkCzRqnAupPCZlq8wvF Ay5uqZtu9KEGPg72ci8EavuuYDP9i4G+sW5xNkQq/twD6vGyY60wGovMs08UlQ1PP+2J0W 019j+90WnOq2PdK60ErzpJx6VaMfyJkd1Fys4JmGt+pHgZUkL0ZzutwejMWW8oMgQozgJg Gxvx2idV9LKjhflzPX0SrJYMkkkD9jBF6XzI9OCTIg94hD1B6tuBRI5o+RlZcA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RD2M31yhtztH4; Sun, 30 Jul 2023 00:29:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36U0Tpdp069401; Sun, 30 Jul 2023 00:29:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36U0Tp09069400; Sun, 30 Jul 2023 00:29:51 GMT (envelope-from git) Date: Sun, 30 Jul 2023 00:29:51 GMT Message-Id: <202307300029.36U0Tp09069400@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 05e7db731d56 - stable/13 - rtld: fix dlopen() for an object that is already mapped but not yet initialized List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 05e7db731d564b276f126465e90f22534dbfd61d Auto-Submitted: auto-generated The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=05e7db731d564b276f126465e90f22534dbfd61d commit 05e7db731d564b276f126465e90f22534dbfd61d Author: Konstantin Belousov AuthorDate: 2023-07-14 13:38:03 +0000 Commit: Konstantin Belousov CommitDate: 2023-07-30 00:29:09 +0000 rtld: fix dlopen() for an object that is already mapped but not yet initialized (cherry picked from commit 1005d3d05362de368b1ea7aeb8eb20cee993e122) --- libexec/rtld-elf/rtld.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index db53fbeb7d08..d6697711eece 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -3758,7 +3758,6 @@ static Obj_Entry * dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags, int mode, RtldLockState *lockstate) { - Obj_Entry *old_obj_tail; Obj_Entry *obj; Objlist initlist; RtldLockState mlockstate; @@ -3775,7 +3774,6 @@ dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags, } GDB_STATE(RT_ADD,NULL); - old_obj_tail = globallist_curr(TAILQ_LAST(&obj_list, obj_entry_q)); obj = NULL; if (name == NULL && fd == -1) { obj = obj_main; @@ -3788,9 +3786,9 @@ dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags, obj->dl_refcount++; if (mode & RTLD_GLOBAL && objlist_find(&list_global, obj) == NULL) objlist_push_tail(&list_global, obj); - if (globallist_next(old_obj_tail) != NULL) { - /* We loaded something new. */ - assert(globallist_next(old_obj_tail) == obj); + + if (!obj->init_done) { + /* We loaded something new and have to init something. */ if ((lo_flags & RTLD_LO_DEEPBIND) != 0) obj->symbolic = true; result = 0;