The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5d9e5f49647e129bf814e7887b8201bfce8b53e3
commit 5d9e5f49647e129bf814e7887b8201bfce8b53e3 Author: Konstantin Belousov <[email protected]> AuthorDate: 2026-08-30 05:20:46 +0000 Commit: Konstantin Belousov <[email protected]> CommitDate: 2026-09-05 22:00:09 +0000 rtld: explain the use of rtld_bind_lock in rtld_get_addr_slow() Discussed with: jrtc27 Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D59269 --- libexec/rtld-elf/rtld.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index f5ef29aaec85..5b40a0b7ab97 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -5462,6 +5462,11 @@ unref_dag(Obj_Entry *root) /* * Common code for MD __tls_get_addr(). + * + * The tcb->tcb_dtv data structure is thread-local. The reason that + * the function needs to take the rtld_bind_lock exclusive (as opposed + * to only shared, to safely access obj_list in allocate_module_tls()) + * is to protect the rtld_malloc data. */ static void * tls_get_addr_slow(struct tcb *tcb, int index, size_t offset, bool locked)
