Hook symbols not found in libc_malloc_debug.so

Josh Leivenzon joshleivenzon@outlook.com
Wed Sep 11 01:11:46 GMT 2024


Thanks for the information.

I have reverse-engineered the proprietary program a little, and found that it attempts to find the missing symbols with dlsym. A simple replication is as follows (though the application actually uses RTLD_DEFAULT instead of a specific library handle):

#include <dlfcn.h>
#include <stdio.h>

int main()
{
    void *lib = dlopen("libc_malloc_debug.so", RTLD_NOW);
    const char *error = dlerror();
    if (error != NULL)
        printf("%s", error);

    void *symbol = dlsym(lib, "__malloc_hook");
    printf("%p, %p, %s\n", lib, symbol, dlerror());
}

When running this program (on Ubuntu this time, to rule out any build issues), I get the following:

0xaabbccdd, (nil), /lib/x86_64-linux-gnu/libc_malloc_debug.so: undefined symbol: __malloc_hook

Does something special need to be done to allow the use of dlsym?


More information about the Libc-help mailing list