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.
This commit is contained in:
Willy Tarreau 2023-03-22 15:47:51 +01:00
parent 9b060f148e
commit 58912b8d92

View file

@ -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.
*/