0

sharedlibrary loaded through LD_PRELOAD, constructor of the same library calls dlopen("libc.so.6")

the problem is dlopen takes forever, debugging showes the following dlopen calls __dlopen which calls calloc, and unknow function ??, then at last __GI___pthread_mutex_lock.

providing unlimited resources before dlopen as I suspected, but doesn't solve the problem.

the problem only happen if LD_PRELOAD is set with sharedlibrary (mentioned above) with target application Firefox at Linux any other application works without problems(dlopen doesn't block)!

Error
  • 820
  • 1
  • 11
  • 34

1 Answers1

0

when does dlopen blocks?

When it needs a lock that is not available for some reason.

debugging showes

You need more debugging. The dlopen calls calloc which requires a malloc lock. Nothing special about that.

It must be that some other thread is holding this malloc lock, and is waiting for your LD_PRELOADed library to finish its initialization (thus creating a deadlock). You should be able to find that other thread with (gdb) thread apply all where.

It may also matter what functions you are trying to interpose in your LD_PRELOADed library.

Employed Russian
  • 199,314
  • 34
  • 295
  • 362