summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
38a7bf2)
Each entry point into lttng-ust that end up taking the ust lock need to
perform a TLS fixup for each thread. Add a TLS fixup in both listener
threads, in fork and base address dump helper libs, and in app context
and tracepoint probe registration/unregistration functions, which can be
called from application threads.
Those ensure we don't take the libc dl lock within the ust lock when
performing the TLS lazy fixup.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
uint32_t hash;
int ret = 0;
uint32_t hash;
int ret = 0;
+ lttng_ust_fixup_tls();
+
/* Provider name starts with "$app.". */
if (strncmp("$app.", provider->name, strlen("$app.") != 0))
return -EINVAL;
/* Provider name starts with "$app.". */
if (strncmp("$app.", provider->name, strlen("$app.") != 0))
return -EINVAL;
void lttng_ust_context_provider_unregister(struct lttng_ust_context_provider *provider)
{
void lttng_ust_context_provider_unregister(struct lttng_ust_context_provider *provider)
{
+ lttng_ust_fixup_tls();
+
if (ust_lock())
goto end;
lttng_ust_context_set_session_provider(provider->name,
if (ust_lock())
goto end;
lttng_ust_context_set_session_provider(provider->name,
+ lttng_ust_fixup_tls();
+
/*
* If version mismatch, don't register, but don't trigger assert
* on caller. The version check just prints an error.
/*
* If version mismatch, don't register, but don't trigger assert
* on caller. The version check just prints an error.
void lttng_probe_unregister(struct lttng_probe_desc *desc)
{
void lttng_probe_unregister(struct lttng_probe_desc *desc)
{
+ lttng_ust_fixup_tls();
+
if (!check_provider_version(desc))
return;
if (!check_provider_version(desc))
return;
void lttng_ust_dummy_get_value(struct lttng_ctx_field *field,
struct lttng_ctx_value *value);
int lttng_context_is_app(const char *name);
void lttng_ust_dummy_get_value(struct lttng_ctx_field *field,
struct lttng_ctx_value *value);
int lttng_context_is_app(const char *name);
+void lttng_ust_fixup_tls(void);
#endif /* _LTTNG_TRACER_CORE_H */
#endif /* _LTTNG_TRACER_CORE_H */
+void lttng_ust_fixup_tls(void)
+{
+ lttng_fixup_urcu_bp_tls();
+ lttng_fixup_ringbuffer_tls();
+ lttng_fixup_vtid_tls();
+ lttng_fixup_nest_count_tls();
+ lttng_fixup_procname_tls();
+ lttng_fixup_ust_mutex_nest_tls();
+}
+
int lttng_get_notify_socket(void *owner)
{
struct sock_info *info = owner;
int lttng_get_notify_socket(void *owner)
{
struct sock_info *info = owner;
int sock, ret, prev_connect_failed = 0, has_waited = 0;
long timeout;
int sock, ret, prev_connect_failed = 0, has_waited = 0;
long timeout;
+ lttng_ust_fixup_tls();
+
/* Restart trying to connect to the session daemon */
restart:
if (prev_connect_failed) {
/* Restart trying to connect to the session daemon */
restart:
if (prev_connect_failed) {
* to be the dynamic linker mutex) and ust_lock, taken within
* the ust lock.
*/
* to be the dynamic linker mutex) and ust_lock, taken within
* the ust lock.
*/
- lttng_fixup_urcu_bp_tls();
- lttng_fixup_ringbuffer_tls();
- lttng_fixup_vtid_tls();
- lttng_fixup_nest_count_tls();
- lttng_fixup_procname_tls();
- lttng_fixup_ust_mutex_nest_tls();
/*
* We want precise control over the order in which we construct
/*
* We want precise control over the order in which we construct
sigset_t all_sigs;
int ret;
sigset_t all_sigs;
int ret;
+ /* Fixup lttng-ust TLS. */
+ lttng_ust_fixup_tls();
+
if (URCU_TLS(lttng_ust_nest_count))
return;
/* Disable signals */
if (URCU_TLS(lttng_ust_nest_count))
return;
/* Disable signals */
if (getenv("LTTNG_UST_WITHOUT_BADDR_STATEDUMP"))
return 0;
if (getenv("LTTNG_UST_WITHOUT_BADDR_STATEDUMP"))
return 0;
+ /*
+ * Fixup lttng-ust TLS when called from dlopen/dlclose
+ * instrumentation.
+ */
+ lttng_ust_fixup_tls();
+
data.owner = owner;
data.exec_found = 0;
/*
data.owner = owner;
data.exec_found = 0;
/*