git: e7951d0b04e6 - main - rtld-elf: Avoid unnecessary lock_restart_for_upgrade() calls
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 02 Feb 2024 14:50:31 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e7951d0b04e6464b37264b8166b1e9ce368a9f1d commit e7951d0b04e6464b37264b8166b1e9ce368a9f1d Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2024-02-01 22:43:05 +0000 Commit: Mark Johnston <markj@FreeBSD.org> 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;