libtnfctl interposes on dlopen(3DL) and dlclose(3DL) in order to be notified of libraries being dynamically opened and closed. This interposition is necessary for internal
process probe control to update its list of probes. In these interposition functions, a lock is acquired to synchronize on traversal of the library list maintained by the runtime linker. To avoid deadlocking
on this lock, tnfctl_internal_open() should not be called from within the init section of a library that can be opened by dlopen(3DL).
Since interposition does not work as expected when a library is opened dynamically, tnfctl_internal_open() should not be used if the client opened libtnfctl
through dlopen(3DL). In this case, the client program should be built with a static dependency
on libtnfctl. Also, if the client program is explicitly linking in -ldl, it should link -ltnfctl before -ldl.
Probes in filtered libraries (see ld(1)) will not be seen because
the filtee (backing library) is loaded lazily on the first symbol reference and not at process startup or dlopen(3DL) time. A workaround is to call tnfctl_check_libs(3TNF) once
the caller is sure that the filtee has been loaded.
|