X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-app.c;h=74ef7f2a79572a28d78a26fd6a6807a7f9d61044;hb=69d5d2ae78d1835f4547a2946d226c2a7a2e513c;hp=ddc7c2336bfac5cfa7029308eaec23b67f14d844;hpb=bc06deb2bd440a8b4c3beb1af065530387f37d43;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index ddc7c2336..74ef7f2a7 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -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 @@ -34,6 +34,8 @@ #include "lttng-sessiond.h" #include "notification-thread-commands.h" #include "rotate.h" +#include "event.h" +#include "ust-field-utils.h" struct lttng_ht *ust_app_ht; struct lttng_ht *ust_app_ht_by_sock; @@ -5493,6 +5495,9 @@ static int reply_ust_register_channel(int sock, int cobjd, chan_reg = ust_registry_channel_find(registry, chan_reg_key); assert(chan_reg); + /* Channel id is set during the object creation. */ + chan_id = chan_reg->chan_id; + if (!chan_reg->register_done) { /* * TODO: eventually use the registry event count for @@ -5507,9 +5512,20 @@ static int reply_ust_register_channel(int sock, int cobjd, } else { /* Get current already assigned values. */ type = chan_reg->header_type; + + /* + * Validate that the context fields match between + * registry and newcoming application. + */ + if (!match_lttng_ust_ctl_field_array(chan_reg->ctx_fields, + chan_reg->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 = chan_reg->chan_id; /* Append to metadata */ if (!chan_reg->metadata_dumped) {