[PATCH RESEND 0/3] elf: allow dl_iterate_phdr() to be called concurrently

Florian Weimer fweimer@redhat.com
Wed Sep 24 08:12:48 GMT 2025


* Caleb Sander Mateos:

> Add support for (recursive) reader-writer locks in rtld, using
> pthread_rwlock internally. Change dl_load_write_lock from a mutex to a
> reader-writer lock to allow concurrent calls to dl_iterate_phdr().
> _dl_add_to_namespace_list() and _dl_close_worker() acquire a write lock
> as they modify the loaded object list, while __dl_iterate_phdr()
> acquires a read lock as it only reads from the list.

I think this change corrupts the libgcc_s unwinder cache in older GCC
because it relies on the lock in dl_iterate_phdr to protect its internal
cache.

We can likely provide a better interface than dl_iterate_phdr if we know
what the application needs.

Thanks,
Florian



More information about the Libc-alpha mailing list