From nobody Fri Feb 09 15:04:28 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 4TWcZh4Vgjz59qs4; Fri, 9 Feb 2024 15:04:28 +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 4TWcZh3Kppz4FTp; Fri, 9 Feb 2024 15:04:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707491068; 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=Ft/vioNek+vxrpSw5OgCOrmkUv7CbBbZwtT/Izowp8I=; b=PnEBfL5SQpUclIk0inO4Y1B0PBcKndnAFGJ4vcDUmhSuCLbCSafTHAF4s7fRLn9RhKIfFM yXK0DLCNeoTRTjuOB/WW9ScymliP6rbXV4ChKkRgdOgM58tD3sCHGHPAex7axPQAQ//aiP JBO+M636sM1CN2BUyH37+plIFhMuoUZE8uiyO4Zt5RwEsFNdu3/HXm0Y4OFfEtNin7WHdd WFZ8ABOB2x3j7tO3S7n1c47vYY9ElwFyrysngiyyAYoexEmCnHetH3k2cOann3sjpU9xoN 9zG9tvESlH/6udNU/Er4yt8f6iCDQ2cdtJPPyAQmwRg+oQvHItFDGahalldg1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707491068; 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=Ft/vioNek+vxrpSw5OgCOrmkUv7CbBbZwtT/Izowp8I=; b=Rfb3Kl+VFlhY7TO8D1GDPG0/hWVemWfV8Q5HXX9dO9sucPQ8JV3jLeJZs1M/HUY6lgWWa0 DOvDH5d1HCE2e3cO3VKlJBI0S4+GqgOI/hKMzHIgbPEv5VxMB6SXXVbash1jj42xVBFpPe Tir0PGTErL0AE+7U4oZtKNjGc1CndvHvDMuY15EPH7JPfxnOALAPsLtFQxUebbDtVPP1Hp CWMiBQbn+K3eX62N+EWQklc7Q6fXWTl7ULqPYvJaOVfW2sN2f3xVcFoDfvIt1/VOgpB24n oJcX4KBYQmR4CMbNQaUsodxk7H8ThmXx4fmS4UJqBhMwrwKmXajBtYOqNGgGeQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707491068; a=rsa-sha256; cv=none; b=qZj68RQjg0VVb2E7m+M77E9zlPyaiiIfCJF08fdTtIJZrwZfOKLHCTQUIeeQSrkxcr6lHE 1uEX/LS0QXM4+fJXfOY3JCPT4EbtFHL4jFNuoRyJFECHao+CCB25/kXsn7+FblWRwBy5SE rql8hBBfqo/ppEclJV4bt/MCBJWHOIITazXNY7sPv0McSfqESGqo/agAON4p8a0xVfMret dsyxoNW50/MQJU3qlluYUDR/MmxmO0JnXn6e1f0dTC+2J0GBaZWV64CVTa5LpkMHgdrotd 18AiU6qVOs+YJ8ioY39HTKMVqcJ31bSB1p5tz2uc0ENn0Eog00i+oLgtVplyZQ== 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 4TWcZh2GFLzdBF; Fri, 9 Feb 2024 15:04:28 +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 419F4SUg085606; Fri, 9 Feb 2024 15:04:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 419F4SCX085603; Fri, 9 Feb 2024 15:04:28 GMT (envelope-from git) Date: Fri, 9 Feb 2024 15:04:28 GMT Message-Id: <202402091504.419F4SCX085603@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: 323226829ae7 - stable/14 - rtld-elf: Avoid unnecessary lock_restart_for_upgrade() calls 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: 323226829ae79094a29198efcc6913a7b48c05ca Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=323226829ae79094a29198efcc6913a7b48c05ca commit 323226829ae79094a29198efcc6913a7b48c05ca Author: Mark Johnston AuthorDate: 2024-02-01 22:43:05 +0000 Commit: Mark Johnston CommitDate: 2024-02-09 14:55:56 +0000 rtld-elf: Avoid unnecessary lock_restart_for_upgrade() calls In order to atomically upgrade the rtld bind lock, load_filtees() may trigger a longjmp back to _rtld_bind() so that the binding can be done with the write lock held. However, the write lock is only needed when filtee objects haven't already been loaded, so move the lock_restart_for_upgrade() call to avoid unnecessary lock upgrades when a filtee is defined. Reviewed by: kib Tested by: brooks MFC after: 1 week Sponsored by: Innovate UK (cherry picked from commit e7951d0b04e6464b37264b8166b1e9ce368a9f1d) --- libexec/rtld-elf/rtld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 0bbd8104e11b..37c016299a66 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -2573,8 +2573,8 @@ static void load_filtees(Obj_Entry *obj, int flags, RtldLockState *lockstate) { - lock_restart_for_upgrade(lockstate); if (!obj->filtees_loaded) { + lock_restart_for_upgrade(lockstate); load_filtee1(obj, obj->needed_filtees, flags, lockstate); load_filtee1(obj, obj->needed_aux_filtees, flags, lockstate); obj->filtees_loaded = true;