From 34952fe5de44a833370cbe87b63fb8eec61466d7 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 11 Nov 2020 13:08:42 -0500 Subject: 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. --- ldso/dynlink.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ldso/dynlink.c') 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))) -- cgit v1.2.1