Fix: perform TLS fixup of nest count outside of UST mutex
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 13 Jun 2012 08:46:44 +0000 (04:46 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 13 Jun 2012 08:46:44 +0000 (04:46 -0400)
Could otherwise lead to a deadlock between the dynamic linker, TLS
fixup, and the UST mutex due to reversed lock acquisition order.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust/lttng-ust-comm.c

index 7a9097014d26e4d483f4d4a9f7d98cbd581807d9..4104a3f563fd400709e7e7d3e8a73a1437321d88 100644 (file)
@@ -136,6 +136,15 @@ extern void ltt_ring_buffer_client_overwrite_exit(void);
 extern void ltt_ring_buffer_client_discard_exit(void);
 extern void ltt_ring_buffer_metadata_client_exit(void);
 
+/*
+ * Force a read (imply TLS fixup for dlopen) of TLS variables.
+ */
+static
+void lttng_fixup_nest_count_tls(void)
+{
+       asm volatile ("" : : "m" (lttng_ust_nest_count));
+}
+
 static
 int setup_local_apps(void)
 {
@@ -872,6 +881,7 @@ void __attribute__((constructor)) lttng_ust_init(void)
        lttng_fixup_event_tls();
        lttng_fixup_ringbuffer_tls();
        lttng_fixup_vtid_tls();
+       lttng_fixup_nest_count_tls();
 
        /*
         * We want precise control over the order in which we construct
This page took 0.027811 seconds and 4 git commands to generate.