Fix: perf counter context deadlock
[lttng-ust.git] / liblttng-ust / lttng-ust-statedump.c
index 4faee07d0017c58eb9d595fdcce3e6524e913a7b..4f989bca9729acb2e931cd614b6520756c4fc9ee 100644 (file)
@@ -191,6 +191,8 @@ int extract_soinfo_events(struct dl_phdr_info *info, size_t size, void *_data)
                                snprintf(resolved_path, PATH_MAX - 1, "[%s]",
                                        info->dlpi_name);
                                so_data.vdso = 1;
+                       } else {
+                               so_data.vdso = 0;
                        }
                }
 
@@ -235,12 +237,22 @@ int do_baddr_statedump(void *owner)
  * session, statedumps from different processes may be
  * interleaved. The vpid context should be used to identify which
  * events belong to which process.
+ *
+ * Grab the ust_lock outside of the RCU read-side lock because we
+ * perform synchronize_rcu with the ust_lock held, which can trigger
+ * deadlocks otherwise.
  */
 int do_lttng_ust_statedump(void *owner)
 {
+       ust_lock_nocheck();
        trace_statedump_start(owner);
+       ust_unlock();
+
        do_baddr_statedump(owner);
+
+       ust_lock_nocheck();
        trace_statedump_end(owner);
+       ust_unlock();
 
        return 0;
 }
This page took 0.023392 seconds and 4 git commands to generate.