Fix: missing RCU read side critical sections
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Mon, 27 Sep 2021 18:01:04 +0000 (14:01 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 28 Jan 2022 22:56:48 +0000 (17:56 -0500)
Based on the comments of the called functions.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ica81b648ce88290c4ca7507fb00a78480457cf01

src/bin/lttng-sessiond/action-executor.cpp
src/bin/lttng-sessiond/event.cpp

index 68c9c71cfed5fdebbeb54eb0c400ac02fa84f7c7..34d3b7130f0a713b089bff4461cab34c9ce36445 100644 (file)
@@ -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;
index d2e4589b247d61cd28accc8fec015dcac6500f67..924df3af175e19bc1e4eedce455ef37487ae0cfa 100644 (file)
@@ -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;
This page took 0.028371 seconds and 5 git commands to generate.