Pre-"fault" the libuuid TLS outside of the ust lock to ensure that we
never deadlock with the linker mutex in libc. This mutex is held both
for TLS fixup of dlopen'd libs, and across execution of all
constructors. We therefore have a reverse use of this mutex wrt ust
lock, that we fix by forcing the TLS fixup to happen very early in the
lttng-ust constructor.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
wildcard->enabled = 0;
return 0;
}
wildcard->enabled = 0;
return 0;
}
+
+/*
+ * Take the TLS "fault" in libuuid if dlopen'd, which can take the
+ * dynamic linker mutex, outside of the UST lock, since the UST lock is
+ * taken in constructors, which are called with dynamic linker mutex
+ * held.
+ */
+void lttng_fixup_event_tls(void)
+{
+ unsigned char uuid[LTTNG_UST_UUID_STR_LEN];
+
+ (void) lttng_ust_uuid_generate(uuid);
+}
void ust_lock(void);
void ust_unlock(void);
void ust_lock(void);
void ust_unlock(void);
+void lttng_fixup_event_tls(void);
+
#endif /* _LTT_TRACER_CORE_H */
#endif /* _LTT_TRACER_CORE_H */
if (uatomic_xchg(&initialized, 1) == 1)
return;
if (uatomic_xchg(&initialized, 1) == 1)
return;
+ /*
+ * Fixup interdependency between TLS fixup mutex (which happens
+ * to be the dynamic linker mutex) and ust_lock, taken within
+ * the ust lock.
+ */
+ lttng_fixup_event_tls();
+
/*
* We want precise control over the order in which we construct
* our sub-libraries vs starting to receive commands from
/*
* We want precise control over the order in which we construct
* our sub-libraries vs starting to receive commands from