X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-app.cpp;h=f08e888c104627981c236cff801c414a9c199b02;hb=21cf9b6b1843774306a76f4dccddddd706b64f79;hp=712e577091975dd97bbae4971d79f6005728168b;hpb=9324443a0907d2bc9f2696ad00d2f9265422ef3d;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/ust-app.cpp b/src/bin/lttng-sessiond/ust-app.cpp index 712e57709..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; @@ -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) {