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.12.0-rc1~663 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=763de384811082b26bafbce1c65d38032ef6ed30;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 9d82b8313..052689a0e 100644 --- a/src/bin/lttng-sessiond/notification-thread-events.c +++ b/src/bin/lttng-sessiond/notification-thread-events.c @@ -2544,6 +2544,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( @@ -2552,6 +2553,7 @@ int handle_notification_thread_trigger_unregister_all( error_occurred = true; } } + rcu_read_unlock(); return error_occurred ? -1 : 0; }