X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-app.cpp;h=f08e888c104627981c236cff801c414a9c199b02;hb=21cf9b6b1843774306a76f4dccddddd706b64f79;hp=ef0f696522694ce31a07e3c10d492ffb0043f03f;hpb=0f1b1d2510d23e9a2a4baa9e2642ef97a35ef83f;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/ust-app.cpp b/src/bin/lttng-sessiond/ust-app.cpp index ef0f69652..f08e888c1 100644 --- a/src/bin/lttng-sessiond/ust-app.cpp +++ b/src/bin/lttng-sessiond/ust-app.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 David Goulet + * Copyright (C) 2011 EfficiOS Inc. * Copyright (C) 2016 Jérémie Galarneau * * SPDX-License-Identifier: GPL-2.0-only @@ -49,7 +49,7 @@ #include "rotate.h" #include "event.h" #include "event-notifier-error-accounting.h" - +#include "ust-field-utils.h" struct lttng_ht *ust_app_ht; struct lttng_ht *ust_app_ht_by_sock; @@ -2232,7 +2232,7 @@ static int create_ust_event_notifier(struct ust_app *app, ua_event_notifier_rule->handle = ua_event_notifier_rule->obj->handle; - DBG2("UST app event notifier %s created successfully: app = '%s': pid = %d), object = %p", + DBG2("UST app event notifier %s created successfully: app = '%s': pid = %d, object = %p", event_notifier.event.name, app->name, app->pid, ua_event_notifier_rule->obj); @@ -3788,7 +3788,7 @@ int create_ust_app_event_notifier_rule(struct lttng_trigger *trigger, lttng_ht_add_unique_u64(app->token_to_event_notifier_rule_ht, &ua_event_notifier_rule->node); - DBG2("UST app create token event rule completed: app = '%s', pid = %d), token = %" PRIu64, + DBG2("UST app create token event rule completed: app = '%s', pid = %d, token = %" PRIu64, app->name, app->pid, lttng_trigger_get_tracer_token(trigger)); goto end; @@ -5268,13 +5268,13 @@ int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app) pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) { - DBG3("UST app wait quiescent failed. Application is dead: pid= %d, sock = %d)", + DBG3("UST app wait quiescent failed. Application is dead: pid= %d, sock = %d", app->pid, app->sock); } else if (ret == -EAGAIN) { - WARN("UST app wait quiescent failed. Communication time out: pid= %d, sock = %d)", + WARN("UST app wait quiescent failed. Communication time out: pid= %d, sock = %d", app->pid, app->sock); } else { - ERR("UST app wait quiescent failed with ret %d: pid= %d, sock = %d)", + ERR("UST app wait quiescent failed with ret %d: pid= %d, sock = %d", ret, app->pid, app->sock); } } @@ -5626,13 +5626,13 @@ static int destroy_trace(struct ltt_ust_session *usess, struct ust_app *app) pthread_mutex_unlock(&app->sock_lock); if (ret < 0) { if (ret == -EPIPE || ret == -LTTNG_UST_ERR_EXITING) { - DBG3("UST app wait quiescent failed. Application is dead: pid= %d, sock = %d)", + DBG3("UST app wait quiescent failed. Application is dead: pid= %d, sock = %d", app->pid, app->sock); } else if (ret == -EAGAIN) { - WARN("UST app wait quiescent failed. Communication time out: pid= %d, sock = %d)", + WARN("UST app wait quiescent failed. Communication time out: pid= %d, sock = %d", app->pid, app->sock); } else { - ERR("UST app wait quiescent failed with ret %d: pid= %d, sock = %d)", + ERR("UST app wait quiescent failed with ret %d: pid= %d, sock = %d", ret, app->pid, app->sock); } } @@ -6120,7 +6120,7 @@ void ust_app_global_update(struct ltt_ust_session *usess, struct ust_app *app) */ void ust_app_global_update_event_notifier_rules(struct ust_app *app) { - DBG2("UST application global event notifier rules update: app = '%s', pid = %d)", + DBG2("UST application global event notifier rules update: app = '%s', pid = %d", app->name, app->pid); if (!app->compatible || !ust_app_supports_notifiers(app)) { @@ -6128,7 +6128,7 @@ void ust_app_global_update_event_notifier_rules(struct ust_app *app) } if (app->event_notifier_group.object == NULL) { - WARN("UST app global update of event notifiers for app skipped since communication handle is null: app = '%s' pid = %d)", + WARN("UST app global update of event notifiers for app skipped since communication handle is null: app = '%s', pid = %d", app->name, app->pid); return; } @@ -6386,6 +6386,9 @@ static int reply_ust_register_channel(int sock, int cobjd, ust_reg_chan = ust_registry_channel_find(registry, chan_reg_key); LTTNG_ASSERT(ust_reg_chan); + /* Channel id is set during the object creation. */ + chan_id = ust_reg_chan->chan_id; + if (!ust_reg_chan->register_done) { /* * TODO: eventually use the registry event count for @@ -6400,9 +6403,19 @@ static int reply_ust_register_channel(int sock, int cobjd, } else { /* Get current already assigned values. */ type = ust_reg_chan->header_type; + /* + * Validate that the context fields match between + * registry and newcoming application. + */ + if (!match_lttng_ust_ctl_field_array(ust_reg_chan->ctx_fields, + ust_reg_chan->nr_ctx_fields, + fields, nr_fields)) { + ERR("Registering application channel due to context field mismatch: pid = %d, sock = %d", + app->pid, app->sock); + ret_code = -EINVAL; + goto reply; + } } - /* Channel id is set during the object creation. */ - chan_id = ust_reg_chan->chan_id; /* Append to metadata */ if (!ust_reg_chan->metadata_dumped) { @@ -6728,7 +6741,7 @@ int ust_app_recv_notify(int sock) WARN("UST app recv channel failed. Communication time out: sock = %d", sock); } else { - ERR("UST app recv channel failed with ret %d: sock = %d)", + ERR("UST app recv channel failed with ret %d: sock = %d", ret, sock); } goto error;