Support dlopen/dlclose of probe providers
Since lttng-ust 2.1, the glibc deadlocks documented within lttng-ust(3) manpage have been worked-around with a "tls fixup" within constructor trick. However, it is still not safe to use dlclose on a provider shared object that is being actively used for tracing due to lack of reference counting from lttng-ust to the used shared object. This leads to either:
- segmentation fault while tracing, since events could use a serialization function located within an unloaded shared object.
- segmentation fault while destroying trace session or exiting process, trying to access the event description located within unloaded shared object.
- segmentation fault while dumping metadata for a trace session, since it would be trying to access event description located within unloaded .so.
Since we don't want to mess with metadata description nor synchronization of tracing while unloading a module, the best solution I can think of (and the solution that is the most similar to the approach taken with lttng-modules for kernel tracing) is to hold a reference count on the provider .so when it's used by a tracing session. One way to do this would be to use dladdr() to lookup the library path, and use a pair of dlopen()/dlclose() at tracing session creation/destruction within lttng-ust to take an extra reference count on each shared object used.
No data to display