From c9753f7250f33184a1859088a691291f37161f25 Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Mon, 27 Sep 2021 14:01:04 -0400 Subject: [PATCH] Fix: missing RCU read side critical sections MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Based on the comments of the called functions. Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau Change-Id: Ica81b648ce88290c4ca7507fb00a78480457cf01 --- src/bin/lttng-sessiond/action-executor.cpp | 8 ++++++++ src/bin/lttng-sessiond/event.cpp | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/bin/lttng-sessiond/action-executor.cpp b/src/bin/lttng-sessiond/action-executor.cpp index 68c9c71cf..34d3b7130 100644 --- a/src/bin/lttng-sessiond/action-executor.cpp +++ b/src/bin/lttng-sessiond/action-executor.cpp @@ -309,6 +309,7 @@ static int action_executor_start_session_handler( } session_lock_list(); + rcu_read_lock(); session = session_find_by_id(LTTNG_OPTIONAL_GET(item->context.session_id)); if (!session) { DBG("Failed to find session `%s` by name while executing `%s` action of trigger `%s`", @@ -353,6 +354,7 @@ error_unlock_session: session_unlock(session); session_put(session); error_unlock_list: + rcu_read_unlock(); session_unlock_list(); end: return ret; @@ -392,6 +394,7 @@ static int action_executor_stop_session_handler( } session_lock_list(); + rcu_read_lock(); session = session_find_by_id(LTTNG_OPTIONAL_GET(item->context.session_id)); if (!session) { DBG("Failed to find session `%s` by name while executing `%s` action of trigger `%s`", @@ -436,6 +439,7 @@ error_unlock_session: session_unlock(session); session_put(session); error_unlock_list: + rcu_read_unlock(); session_unlock_list(); end: return ret; @@ -475,6 +479,7 @@ static int action_executor_rotate_session_handler( } session_lock_list(); + rcu_read_lock(); session = session_find_by_id(LTTNG_OPTIONAL_GET(item->context.session_id)); if (!session) { DBG("Failed to find session `%s` by name while executing `%s` action of trigger `%s`", @@ -526,6 +531,7 @@ error_unlock_session: session_unlock(session); session_put(session); error_unlock_list: + rcu_read_unlock(); session_unlock_list(); end: return ret; @@ -580,6 +586,7 @@ static int action_executor_snapshot_session_handler( } session_lock_list(); + rcu_read_lock(); session = session_find_by_id(LTTNG_OPTIONAL_GET(item->context.session_id)); if (!session) { DBG("Failed to find session `%s` by name while executing `%s` action of trigger `%s`", @@ -620,6 +627,7 @@ error_unlock_session: session_unlock(session); session_put(session); error_unlock_list: + rcu_read_unlock(); session_unlock_list(); end: return ret; diff --git a/src/bin/lttng-sessiond/event.cpp b/src/bin/lttng-sessiond/event.cpp index d2e4589b2..924df3af1 100644 --- a/src/bin/lttng-sessiond/event.cpp +++ b/src/bin/lttng-sessiond/event.cpp @@ -471,6 +471,7 @@ static int agent_enable(struct agent *agt, LTTNG_ASSERT(event); LTTNG_ASSERT(agt); + rcu_read_lock(); aevent = agent_find_event(event->name, event->loglevel_type, event->loglevel, filter_expression, agt); if (!aevent) { @@ -519,6 +520,7 @@ error: agent_destroy_event(aevent); } end: + rcu_read_unlock(); free(filter); free(filter_expression); return ret; -- 2.34.1