From nobody Fri Feb 9 15:04:27 2024 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 4TWcZg439Xz59qmD; Fri, 9 Feb 2024 15:04:27 +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 4TWcZg2HPrz4FTS; Fri, 9 Feb 2024 15:04:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707491067; 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=k5wlSsehDB3+pzF45/KNOqtQLQ2WIP/614he4cN2TAo=; b=wgR3bINZBUG2DKWf+lAOiIwfha9iChoCwCI/zZM9cyaCIYKLwnZZrf6GP3hFYF+Q5dgOGL kBwai/7PKjahiBcIqXVu0QIRlgNynPngmCRYsnO3EVNt9KwcP7K9H5K+tJ3r4QeLWUry8t crhoAVEs3sZjIYCEoSRDrhU7evKJsEwZnN+SjFUBktYEasM5LWWT6lotDxILyTHeeXFcNf GpI2mm1GlNaniSdc9H8mhSNwIl9iHIHGVV6btwny+KHEJ7ayM6v4zEE8xgAAm9SLTw4HMe 8D1MrRkBUq7WNFM+nCpMEKm3TWwbKLipFS6J6yGvb2BrMhkN3PNb+pSqnXn+CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707491067; 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=k5wlSsehDB3+pzF45/KNOqtQLQ2WIP/614he4cN2TAo=; b=Pclg16r39xN330BhIeFAKx5bL0oEo0t5YqgwpCzBXvwI3kLqkjyhhy/5so/OTQQFEeQiuM VhE39gvqlii+fTQeXRLa6lSlsdr17HqJcD4LvYRyPyqdSDMQHF3uCtXKaRUURTsBYHHpaC seQFTR52xJi/ZEapbOX0u9qkq8xtqZ0/+FjmxgC97x5Jy1f0IaKzjQANQVBNF3RCOmiXzU 3huAuPKYj/LOUTRONTSBc/is7YuPJQSoqpEo/SnCg7gK/NOWmJgRnastLl0pH9KvKLaw94 DPKHAmEIjN1A26YUgUxB8pn/vLysYsh4wjJ4yJYPwwh1kJTAKjeudhDYCSXHlQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707491067; a=rsa-sha256; cv=none; b=MBk6r5/y+Td2Gtf7JE7htLXUv96KNoqetFJJYqSqFTGccr4I5UCKDoYi6PZaSkpu6bznL8 0TFUDuQouGsSsKIW2ms6M2jcALkoB8wpreQ9VU+QcKMqOC8iIDFCOk/pLf0jaCTghmqaWj Epayn59o2F9nRl1xfhoVf1Xm8r7QgnBKXwyxyVnIFVGw7VE6o8/1hEEAJuJrgbgfE6useX 8qF5DA6S0RhzqwsDbOJEBlzOoVs8pBypbBSph7TJvP9oWu13NOtJUlNBX8KluMtRX0OcTn Uunf3yXjE47JiImGWPHhAeuEME6SJtXxxK55l7PU4M8I6tfp6GEzGlI34hHWKQ== 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 4TWcZg1PCwzd7f; Fri, 9 Feb 2024 15:04:27 +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 419F4RDs085562; Fri, 9 Feb 2024 15:04:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 419F4R23085559; Fri, 9 Feb 2024 15:04:27 GMT (envelope-from git) Date: Fri, 9 Feb 2024 15:04:27 GMT Message-Id: <202402091504.419F4R23085559@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: d146da5d08d4 - stable/14 - libthr: Force the thr_wake() symbol to be resolved during initialization 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: d146da5d08d432b455d717e03d9130be166b8edb Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d146da5d08d432b455d717e03d9130be166b8edb commit d146da5d08d432b455d717e03d9130be166b8edb Author: Mark Johnston AuthorDate: 2024-02-02 14:23:53 +0000 Commit: Mark Johnston CommitDate: 2024-02-09 14:55:46 +0000 libthr: Force the thr_wake() symbol to be resolved during initialization Otherwise the lock upgrade performed by rtld's load_filtees() can result in infinite recursion, wherein: 1. _rtld_bind() acquires the bind read lock, 2. the source DSO's filtees haven't been loaded yet, so the lock upgrade in load_filtees() cause rtld to jump to _rtld_bind() and release the bind lock, 3. _thr_rtld_lock_release() calls _thr_ast(), which calls thr_wake(), which hasn't been resolved yet, 4. _rtld_bind() acquires the bind read lock in order to resolve thr_wake(), 5. ... See the linked pull request for an instance of this problem arising with libsys. That particular instance is also worked around by commit e7951d0b04e6. Reported by: brooks Reviewed by: kib Pull Request: https://github.com/freebsd/freebsd-src/pull/908 MFC after: 1 week Sponsored by: Innovate UK (cherry picked from commit 36f0a34ca645d49ec79d60ea7e773374ef0991ea) --- lib/libthr/thread/thr_rtld.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libthr/thread/thr_rtld.c b/lib/libthr/thread/thr_rtld.c index 9026abf941e2..767b4735e1fa 100644 --- a/lib/libthr/thread/thr_rtld.c +++ b/lib/libthr/thread/thr_rtld.c @@ -238,6 +238,7 @@ _thr_rtld_init(void) mprotect(NULL, 0, 0); _rtld_get_stack_prot(); + thr_wake(-1); li.rtli_version = RTLI_VERSION; li.lock_create = _thr_rtld_lock_create;