From nobody Fri Feb 02 14:50:31 2024 X-Original-To: dev-commits-src-main@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 4TRJbr02bNz58t8x; Fri, 2 Feb 2024 14:50:32 +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 4TRJbq631Xz4HXk; Fri, 2 Feb 2024 14:50:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706885431; 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=2QGrHDpdwxA6QzR/g3K4YrDaofG3kZplDTINTJkGOec=; b=fYSESaWiZeMuHl0vmxJDgfqdJGDAPHiTEIOxSJvu/P7BlXOmUA3SoMDLqIBts1sNbUdvsE 1ZIn+wxs6F7JQ7K2oPjvUSDAKSPXL0LPEEge5ul+7g/1sp1wXshA1lsg+0NfaJ3u5svyXE K9Ic27Nj9r3uYnItczh8f9F9ciFQOTOarhNt9lwEi76tMfvLxN9C498CS3OTK/Sf8LjpUg BjHroKqOOCNslaLUCXFfmWP9Tb7zlxXGokp1GEaJcdZGWi055cS4nSd1vUGOjMlJl+a/Me TVw5oFh9kebENTedf8EgLPH0cl0a7LdyFoRvX7wCbOisgg6KYEZ0PrsBdNshag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706885431; 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=2QGrHDpdwxA6QzR/g3K4YrDaofG3kZplDTINTJkGOec=; b=px8W/i09LdDqJCN/7OxZNPV8KvpfgufDz8Tumlvt+X/W1hs4jkQZo1RoF1MWeU0ARX3oCl X71kP9a9KjEhFEuDvhwLrXbbnB8CT8gLdMqKD8fw6dlz8+JWVsmhArEgzDQP5rqzkwItzG hW6CX0vOKI4IXg+gkzxCq59c8BIuuEial1XTk3bbu1Hqw6pP5DDzitjkiiEOxyt5vx9AWF Fod0gVCrXmYmYkUKTeIJyF2pHgBiMuVGROpvbePsSn6VSRnPOcWi0BMiXf2b+8MaDUZl9j 1nu81C61vVpARPtUTG9U8HeOh/vBXsDhrlbkETj6rObfKDTwiV3Pka2fscX8QQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706885431; a=rsa-sha256; cv=none; b=xjRieyNzeMdw+/lRGabxXMMbg+cES/iLe1682CudeC32U8AggeS1dR7fNzseOvo4n+6/X5 WQ7BO2rfcUtniLTorC6Azrv8ZHEOM2PX95rpsa4LptQyuK5chATXPNzy0DSX2tnG3f8+T6 1FavqBTujjeDZFq80M70LF0VdgryPTJp/9oDyZ1drFI5iUq8zB9qUhXGBXziZOLcqL5Zds qgm/uL+1IT2qr1ij3iW72t+t9YAag+kc/LsJIAFrABRUQ5iUrhShgyG0rNljS05nISdElI JotWhUk0tVP3BztlT7K7ETDS4bsWjDuRnAAU613F9sWL99Oi6btgKtSaeu+oXg== 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 4TRJbq56Yxzb2V; Fri, 2 Feb 2024 14:50:31 +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 412EoVIL026294; Fri, 2 Feb 2024 14:50:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 412EoVO5026291; Fri, 2 Feb 2024 14:50:31 GMT (envelope-from git) Date: Fri, 2 Feb 2024 14:50:31 GMT Message-Id: <202402021450.412EoVO5026291@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: e7951d0b04e6 - main - rtld-elf: Avoid unnecessary lock_restart_for_upgrade() calls List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: e7951d0b04e6464b37264b8166b1e9ce368a9f1d Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e7951d0b04e6464b37264b8166b1e9ce368a9f1d commit e7951d0b04e6464b37264b8166b1e9ce368a9f1d Author: Mark Johnston AuthorDate: 2024-02-01 22:43:05 +0000 Commit: Mark Johnston CommitDate: 2024-02-02 14:39:54 +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 --- 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 2c4111cc457a..24abc4580f53 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -2583,8 +2583,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;