about summary refs log tree commit diff
path: root/ldso
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2020-11-11 13:08:42 -0500
committerRich Felker <dalias@aerifal.cx>2020-11-11 13:31:50 -0500
commit34952fe5de44a833370cbe87b63fb8eec61466d7 (patch)
tree6d1cca357ba7a71778fc790db1ae394cd59f0a06 /ldso
parent8d37958d58cf36f53d5fcc7a8aa6d633da6071b2 (diff)
downloadmusl-34952fe5de44a833370cbe87b63fb8eec61466d7.tar.gz
musl-34952fe5de44a833370cbe87b63fb8eec61466d7.tar.xz
musl-34952fe5de44a833370cbe87b63fb8eec61466d7.zip
convert malloc use under libc-internal locks to use internal allocator
this change lifts undocumented restrictions on calls by replacement
mallocs to libc functions that might take these locks, and sets the
stage for lifting restrictions on the child execution environment
after multithreaded fork.

care is taken to #define macros to replace all four functions (malloc,
calloc, realloc, free) even if not all of them will be used, using an
undefined symbol name for the ones intended not to be used so that any
inadvertent future use will be caught at compile time rather than
directed to the wrong implementation.
Diffstat (limited to 'ldso')
-rw-r--r--ldso/dynlink.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ldso/dynlink.c b/ldso/dynlink.c
index 502e52c5..61714f40 100644
--- a/ldso/dynlink.c
+++ b/ldso/dynlink.c
@@ -23,6 +23,11 @@
 #include "libc.h"
 #include "dynlink.h"
 
+#define malloc __libc_malloc
+#define calloc __libc_calloc
+#define realloc __libc_realloc
+#define free __libc_free
+
 static void error(const char *, ...);
 
 #define MAXP2(a,b) (-(-(a)&-(b)))