From: David Goulet Date: Fri, 28 Mar 2014 13:58:03 +0000 (-0400) Subject: Fix: take session list lock when listing tp X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=ae7f78f3ce5a2df716bc3e6bcea45bff0b85df0b Fix: take session list lock when listing tp 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 --- diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 0fb80fa44..34f322294 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -2922,7 +2922,9 @@ skip_domain: struct lttng_event *events; ssize_t nb_events; + session_lock_list(); 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; @@ -2953,8 +2955,10 @@ skip_domain: struct lttng_event_field *fields; ssize_t nb_fields; + session_lock_list(); 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;