git: 5f195cb44bee - stable/14 - rtld: do not call into ifunc resolvers with the bind lock write-locked
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 10 May 2025 19:33:09 UTC
The branch stable/14 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=5f195cb44beee2ee952252245937a9bb7a395e38
commit 5f195cb44beee2ee952252245937a9bb7a395e38
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-05-01 15:44:12 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-05-10 18:57:45 +0000
rtld: do not call into ifunc resolvers with the bind lock write-locked
PR: 286502
(cherry picked from commit c66c0a8479e62f3e3e085252839cddace4d4bbf5)
---
libexec/rtld-elf/rtld.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 6375867d1db1..ba8e2aea6e7c 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -1018,6 +1018,7 @@ _rtld_bind(Obj_Entry *obj, Elf_Size reloff)
Elf_Addr target;
RtldLockState lockstate;
+relock:
rlock_acquire(rtld_bind_lock, &lockstate);
if (sigsetjmp(lockstate.env, 0) != 0)
lock_upgrade(rtld_bind_lock, &lockstate);
@@ -1031,10 +1032,15 @@ _rtld_bind(Obj_Entry *obj, Elf_Size reloff)
NULL, &lockstate);
if (def == NULL)
rtld_die();
- if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC)
+ if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) {
+ if (lockstate_wlocked(&lockstate)) {
+ lock_release(rtld_bind_lock, &lockstate);
+ goto relock;
+ }
target = (Elf_Addr)rtld_resolve_ifunc(defobj, def);
- else
+ } else {
target = (Elf_Addr)(defobj->relocbase + def->st_value);
+ }
dbg("\"%s\" in \"%s\" ==> %p in \"%s\"",
defobj->strtab + def->st_name,