From: Rich Felker Date: Sat, 17 Dec 2022 21:00:19 +0000 (-0500) Subject: use libc-internal malloc for pthread_atfork X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;ds=sidebyside;h=9532ae1318201d66b235a618df16aac0b3386630;p=musl use libc-internal malloc for pthread_atfork while no lock is held here making it a lock-order issue, replacement malloc is likely to want to use pthread_atfork, possibly making the call to malloc infinitely recursive. even if not, there is no reason to prefer an application-provided malloc here. --- diff --git a/src/thread/pthread_atfork.c b/src/thread/pthread_atfork.c index 6d348ac8..26d32543 100644 --- a/src/thread/pthread_atfork.c +++ b/src/thread/pthread_atfork.c @@ -3,6 +3,11 @@ #include "libc.h" #include "lock.h" +#define malloc __libc_malloc +#define calloc undef +#define realloc undef +#define free undef + static struct atfork_funcs { void (*prepare)(void); void (*parent)(void);