Hi,

I'm wondering about the way Ganesha loads the FSAL

in load_fsal we have
#if defined(LINUX) && !defined(SANITIZE_ADDRESS)
dl = dlopen(path, RTLD_NOW | RTLD_LOCAL | RTLD_DEEPBIND);
#elif defined(FREEBSD) || defined(SANITIZE_ADDRESS)
dl = dlopen(path, RTLD_NOW | RTLD_LOCAL);
#endif

On my system Ganesha is built with jemalloc but my FSAL is not (it's not using the same build chain)

My FSAL is using malloc_usable_size.
Ganesha does not use this symbol so it is resolved during dlopen.
Because the RTLD_DEEPBIND flag is used, the libc version of malloc_usable_size is instead of the jemalloc one which ultimately leads to a crash.

I could make sure both are built with the same allocator but this also happens when I try to dynamically change the memory allocator (LD_PRELOAD tcmalloc).

Looking to the history (back in 2012) the RTLD_DEEPBIND flags has been introduced / removed and finally kept.

Can somebody remember the reason why it is needed ?
Did someone else had this kind of issue with LD_PRELOAD ?

Thanks for your help,
Regards,

Olivier