git: cee16ae06de7 - stable/13 - rtld: unlock bind lock when calling into crt __pthread_distribute_static_tls method

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sun, 27 Aug 2023 00:51:27 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=cee16ae06de7c08cf97c918d73cfac33cc056a2d

commit cee16ae06de7c08cf97c918d73cfac33cc056a2d
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-08-18 19:52:24 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-08-27 00:50:17 +0000

    rtld: unlock bind lock when calling into crt __pthread_distribute_static_tls method
    
    (cherry picked from commit b1d3e2b771552af071bf0964233cc5a76ea25542)
---
 libexec/rtld-elf/rtld.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index e3f87c6504a5..e8b901bda634 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -5943,8 +5943,10 @@ distribute_static_tls(Objlist *list, RtldLockState *lockstate)
 		obj = elm->obj;
 		if (obj->marker || !obj->tls_static || obj->static_tls_copied)
 			continue;
+		lock_release(rtld_bind_lock, lockstate);
 		distrib(obj->tlsoffset, obj->tlsinit, obj->tlsinitsize,
 		    obj->tlssize);
+		wlock_acquire(rtld_bind_lock, lockstate);
 		obj->static_tls_copied = true;
 	}
 }