From: Jérémie Galarneau Date: Wed, 23 Jan 2019 20:29:14 +0000 (-0500) Subject: Fix: missing rcu read locking in trigger "unregister all" command X-Git-Tag: v2.10.7~28 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6bfc8da05c035890b24a6563647ad35afeee0ed8;p=lttng-tools.git Fix: missing rcu read locking in trigger "unregister all" command While the notification subsystem all runs within a single thread, the iteration over the triggers hash table must be protected using the RCU read-side lock since the RCU worker may resize the hash table while the iteration is performed. Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/notification-thread-events.c b/src/bin/lttng-sessiond/notification-thread-events.c index 4799c7186..81acd7230 100644 --- a/src/bin/lttng-sessiond/notification-thread-events.c +++ b/src/bin/lttng-sessiond/notification-thread-events.c @@ -1572,6 +1572,7 @@ int handle_notification_thread_trigger_unregister_all( struct cds_lfht_iter iter; struct lttng_trigger_ht_element *trigger_ht_element; + rcu_read_lock(); cds_lfht_for_each_entry(state->triggers_ht, &iter, trigger_ht_element, node) { int ret = handle_notification_thread_command_unregister_trigger( @@ -1580,6 +1581,7 @@ int handle_notification_thread_trigger_unregister_all( error_occurred = true; } } + rcu_read_unlock(); return error_occurred ? -1 : 0; }