From nobody Fri Feb 02 15:32:43 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 4TRKXW3GYlz58y2m; Fri, 2 Feb 2024 15:32:43 +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 4TRKXW2Qcmz4N0R; Fri, 2 Feb 2024 15:32:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706887963; 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=KzFP9uoRb5lpCNDv4N+fO1owvOKzVdZA4o2mk0vADfM=; b=VvnTwa6zsa8sknOSP+f/sI1+YqKRIYJehhKUk+QuLrNugtEAkNmc5jyJ7/GWddEcoKoAxq 2g0RgWEHFRdVUVMiKZsMbbTk88QHdp0MLknYoBthhH/HAfszrCmYaeQ2xcrk9In3IjUKOZ lL+0Wp9N/2X3vuUU6oNqQnc4SNAxJ+JDMxuMobrx1jK0wmLM4ynMyam11C5UkUN2hbhf3N S4Sk5KivMwOC97VHJlD4BmxsTvjDawXZgFcuwJOb11D6cF9S+Ys0XzOilJFUD93unsEzHD 0FQ+rovsUr80fs/UaR9O3QdqHRybLu7LZgE8iWb9ABHaJF6uESVkuYtFxKCDFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706887963; 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=KzFP9uoRb5lpCNDv4N+fO1owvOKzVdZA4o2mk0vADfM=; b=xeXbSqIgZk2HEr1g5+PJvfssgC9EIJb6KOAcfRcLefs28WM+Ye/+gVmMUq+eUuaswiJ1I3 gTiRnVhZuktac5gj/Kn0NSBXEfH2IBneeOHMh8G0yDftz9GlLEeQJhDC4NXgwSOkdrOKey B5n6xtzG8SE+f+L9qS/Y5smM10x2tZR7xvIdv092/hS3kAeQA4if/ntsRB7FeP4T0yMGrc Sy4YP7PViX6FF8VUOySDKP9pICJeOIHJmmBT/RKpWiOX2a0jdrS/py//BEX/sk1gjxpcHr OQbmZL7jSpCQNs8cpACW0f4ivxUolpilV9Qi48UMhmCwYMSv59kf1hTv6rsG3w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706887963; a=rsa-sha256; cv=none; b=j0Zu7HDkShmBH5ISESGMsgNdYGiaIYPiKc5Oaul3MyaCzh8lCtq76D5BFwIb6Kz5e16Kla OlAH6gqP7wvDio9T0jHQ6Fy34J7WczyXiJKRF7k40+5MmQY9AzsEXsdI8+SLfJnCmIqFJa WQ8ejwAfy9vuPleoDXO3D3yYqrt5NhTXmsOxM+/ErEQHakcFCtOi7Q2r74xeMtvrjy5LNR amc55oRzM8cl4gtvGUzk+b/X7p0SRr26PJq5qfmy+vDYWqkXd+3AQuG9Zez/3sVmLfR1RM nWQgsatSkrlu5z2E/UQPhAoHoJ+DMLscAL+pOaarmaYEuoHH5UUvkrNmFjX5Gg== 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 4TRKXW1TVVzc5H; Fri, 2 Feb 2024 15:32:43 +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 412FWhSX000386; Fri, 2 Feb 2024 15:32:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 412FWhop000383; Fri, 2 Feb 2024 15:32:43 GMT (envelope-from git) Date: Fri, 2 Feb 2024 15:32:43 GMT Message-Id: <202402021532.412FWhop000383@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 36f0a34ca645 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 36f0a34ca645d49ec79d60ea7e773374ef0991ea Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=36f0a34ca645d49ec79d60ea7e773374ef0991ea commit 36f0a34ca645d49ec79d60ea7e773374ef0991ea Author: Mark Johnston AuthorDate: 2024-02-02 14:23:53 +0000 Commit: Mark Johnston CommitDate: 2024-02-02 15:32:30 +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 --- 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;