opnsense-src/lib/libthr/thread
Kyle Evans c5a7b5882a libthr: allow very early atfork registration
LSan wants to be able to register atfork handlers at __lsan_init time,
which can happen either at the first intercepted function call or in a
.preinit_array function.  Both of these end up being very early in rtld
and executed with the bind lock held, which ends up causing problems
when we go to _libpthread_init().

Instead of requiring libpthread to be initialized, just insert the new
atfork handler straight into the list if it's not ready yet.  The
critical section and locking should not be necessary if we're really
executing this early, as there won't be any threads to contend with.

Reviewed by:	kib (earlier version), markj

(cherry picked from commit 4b202f4faf40fd7af8b84491360186aed8ce5733)
2024-11-21 22:54:55 -06:00
..
Makefile.inc libthr: add pthread_sigqueue(3) 2024-04-30 03:48:09 +03:00
thr_affinity.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_attr.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_autoinit.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_barrier.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_barrierattr.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_cancel.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_clean.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_concurrency.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_cond.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_condattr.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_create.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_ctrdtr.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
thr_detach.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_equal.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_event.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_exit.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_fork.c libthr: allow very early atfork registration 2024-11-21 22:54:55 -06:00
thr_getcpuclockid.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_getprio.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_getschedparam.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_getthreadid_np.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_info.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_init.c libthr: allow very early atfork registration 2024-11-21 22:54:55 -06:00
thr_join.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_kern.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
thr_kill.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_list.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
thr_main_np.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_malloc.c Remove "All Rights Reserved" from FreeBSD Foundation copyrights 2024-08-06 15:39:53 -04:00
thr_multi_np.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_mutex.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_mutexattr.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_once.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_printf.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_private.h libthr: Preresolve selected EABI symbols on arm. 2024-07-31 14:10:58 +02:00
thr_pshared.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
thr_pspinlock.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_resume_np.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_rtld.c libthr: Preresolve selected EABI symbols on arm. 2024-07-31 14:10:58 +02:00
thr_rwlock.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_rwlockattr.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_self.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_sem.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_setprio.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_setschedparam.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_sig.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_sigqueue.c libthr: add pthread_sigqueue(3) 2024-04-30 03:48:09 +03:00
thr_single_np.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_sleepq.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_spec.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_spinlock.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
thr_stack.c rtld: avoid division in __thr_map_stacks_exec() 2024-08-05 03:32:11 +03:00
thr_suspend_np.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_switch_np.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_symbols.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
thr_syscalls.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_umtx.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00
thr_umtx.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
thr_yield.c libthr: remove explicit sys/cdefs.h includes 2024-03-13 02:30:40 +02:00