Fix: take session list lock when listing tp
authorDavid Goulet <dgoulet@efficios.com>
Fri, 28 Mar 2014 13:58:03 +0000 (09:58 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 1 Apr 2014 14:55:04 +0000 (10:55 -0400)
This is important since the list tracepoints command access the
application socket to ask the application for its TPs. The session list
lock protects the ordering of message for those sockets.

This was triggering out of order message between the session daemon and
an application thus triggering undefined behavior.

Fixes #774

Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/main.c

index 2f90b3b30fcd132ce4e9c6597b33dffbed1b03d2..5c5bda277373080f89f61772fb73a41b25d1c80c 100644 (file)
@@ -3161,7 +3161,9 @@ skip_domain:
                struct lttng_event *events;
                ssize_t nb_events;
 
                struct lttng_event *events;
                ssize_t nb_events;
 
+               session_lock_list();
                nb_events = cmd_list_tracepoints(cmd_ctx->lsm->domain.type, &events);
                nb_events = cmd_list_tracepoints(cmd_ctx->lsm->domain.type, &events);
+               session_unlock_list();
                if (nb_events < 0) {
                        /* Return value is a negative lttng_error_code. */
                        ret = -nb_events;
                if (nb_events < 0) {
                        /* Return value is a negative lttng_error_code. */
                        ret = -nb_events;
@@ -3192,8 +3194,10 @@ skip_domain:
                struct lttng_event_field *fields;
                ssize_t nb_fields;
 
                struct lttng_event_field *fields;
                ssize_t nb_fields;
 
+               session_lock_list();
                nb_fields = cmd_list_tracepoint_fields(cmd_ctx->lsm->domain.type,
                                &fields);
                nb_fields = cmd_list_tracepoint_fields(cmd_ctx->lsm->domain.type,
                                &fields);
+               session_unlock_list();
                if (nb_fields < 0) {
                        /* Return value is a negative lttng_error_code. */
                        ret = -nb_fields;
                if (nb_fields < 0) {
                        /* Return value is a negative lttng_error_code. */
                        ret = -nb_fields;
This page took 0.027075 seconds and 4 git commands to generate.