From: Willy Tarreau Date: Wed, 22 Mar 2023 14:47:51 +0000 (+0100) Subject: MINOR: tools: relax dlopen() on malloc/free checks X-Git-Tag: v2.8-dev6~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=58912b8d92c161bf7226e791d5727857dbfcd51d;p=thirdparty%2Fhaproxy.git MINOR: tools: relax dlopen() on malloc/free checks Now that we can provide a safe malloc_trim() we don't need to detect anymore that some dependencies use a different set of malloc/free functions than ours because they will use the same as those we're seeing, and we control their use of malloc_trim(). The comment about the incompatibility with DEBUG_MEM_STATS is not true anymore either since the feature relies on macros so we're now OK. This will stop catching libraries linked against glibc's allocator when haproxy is natively built with jemalloc. This was especially annoying since dlopen() on a lib depending on jemalloc() tends to fail on TLS issues. --- diff --git a/src/tools.c b/src/tools.c index a4572b954b..8001b8dd42 100644 --- a/src/tools.c +++ b/src/tools.c @@ -6078,8 +6078,6 @@ void *dlopen(const char *filename, int flags) const char *name; void *curr, *next; } check_syms[] = { - { .name = "malloc", }, - { .name = "free", }, { .name = "SSL_library_init", }, { .name = "X509_free", }, /* insert only above, 0 must be the last one */ @@ -6100,7 +6098,7 @@ void *dlopen(const char *filename, int flags) /* save a few pointers to critical symbols. We keep a copy of both the * current and the next value, because we might already have replaced - * some of them (e.g. malloc/free with DEBUG_MEM_STATS), and we're only + * some of them in an inconsistent way (i.e. not all), and we're only * interested in verifying that a loaded library doesn't come with a * completely different definition that would be incompatible. */