From: Jérémie Galarneau Date: Sun, 15 Sep 2019 17:19:22 +0000 (-0400) Subject: sessiond: fix: possible unaligned access in packed structure X-Git-Tag: v2.11.0-rc4~30 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6938db9cf8f24fcaee5820d657a5f74d874459a5;p=lttng-tools.git sessiond: fix: possible unaligned access in packed structure A number of (potentially) unaligned pointers are used in client command handlers to pass command parameters to other internal functions. Fixing those forces a number of const-correctness changes where contexts are passed as arguments. Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/agent.c b/src/bin/lttng-sessiond/agent.c index 3b8acd2a2..9ea899f57 100644 --- a/src/bin/lttng-sessiond/agent.c +++ b/src/bin/lttng-sessiond/agent.c @@ -708,7 +708,7 @@ void destroy_app_ctx(struct agent_app_ctx *ctx) } static -struct agent_app_ctx *create_app_ctx(struct lttng_event_context *ctx) +struct agent_app_ctx *create_app_ctx(const struct lttng_event_context *ctx) { struct agent_app_ctx *agent_ctx = NULL; @@ -738,7 +738,7 @@ end: * * Return LTTNG_OK on success or else a LTTNG_ERR* code. */ -int agent_enable_context(struct lttng_event_context *ctx, +int agent_enable_context(const struct lttng_event_context *ctx, enum lttng_domain_type domain) { int ret; @@ -1166,7 +1166,7 @@ void agent_add_event(struct agent_event *event, struct agent *agt) /* * Unique add of a agent context to an agent object. */ -int agent_add_context(struct lttng_event_context *ctx, struct agent *agt) +int agent_add_context(const struct lttng_event_context *ctx, struct agent *agt) { int ret = LTTNG_OK; struct agent_app_ctx *agent_ctx = NULL; diff --git a/src/bin/lttng-sessiond/agent.h b/src/bin/lttng-sessiond/agent.h index c0808c48f..ea5662754 100644 --- a/src/bin/lttng-sessiond/agent.h +++ b/src/bin/lttng-sessiond/agent.h @@ -153,9 +153,10 @@ void agent_delete_event(struct agent_event *event, struct agent *agt); void agent_destroy_event(struct agent_event *event); /* Agent context API.*/ -int agent_enable_context(struct lttng_event_context *ctx, +int agent_enable_context(const struct lttng_event_context *ctx, enum lttng_domain_type domain); -int agent_add_context(struct lttng_event_context *ctx, struct agent *agt); +int agent_add_context(const struct lttng_event_context *ctx, + struct agent *agt); /* Agent app API. */ struct agent_app *agent_create_app(pid_t pid, enum lttng_domain_type domain, diff --git a/src/bin/lttng-sessiond/client.c b/src/bin/lttng-sessiond/client.c index fa7672b58..956dab8c8 100644 --- a/src/bin/lttng-sessiond/client.c +++ b/src/bin/lttng-sessiond/client.c @@ -410,7 +410,7 @@ error: * Should *NOT* be called with RCU read-side lock held. */ static int create_ust_session(struct ltt_session *session, - struct lttng_domain *domain) + const struct lttng_domain *domain) { int ret; struct ltt_ust_session *lus = NULL; @@ -950,7 +950,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock, /* Create UST session if none exist. */ if (cmd_ctx->session->ust_session == NULL) { ret = create_ust_session(cmd_ctx->session, - &cmd_ctx->lsm->domain); + ALIGNED_CONST_PTR(cmd_ctx->lsm->domain)); if (ret != LTTNG_OK) { goto error; } @@ -1139,7 +1139,7 @@ skip_domain: ret = cmd_add_context(cmd_ctx->session, cmd_ctx->lsm->domain.type, cmd_ctx->lsm->u.context.channel_name, - &cmd_ctx->lsm->u.context.ctx, + ALIGNED_CONST_PTR(cmd_ctx->lsm->u.context.ctx), kernel_poll_pipe[1]); cmd_ctx->lsm->u.context.ctx.u.app_ctx.provider_name = NULL; @@ -1187,18 +1187,18 @@ error_add_context: count -= (size_t) ret; } } - /* FIXME: passing packed structure to non-packed pointer */ ret = cmd_disable_event(cmd_ctx->session, cmd_ctx->lsm->domain.type, cmd_ctx->lsm->u.disable.channel_name, - &cmd_ctx->lsm->u.disable.event); + ALIGNED_CONST_PTR(cmd_ctx->lsm->u.disable.event)); break; } case LTTNG_ENABLE_CHANNEL: { cmd_ctx->lsm->u.channel.chan.attr.extended.ptr = (struct lttng_channel_extended *) &cmd_ctx->lsm->u.channel.extended; - ret = cmd_enable_channel(cmd_ctx->session, &cmd_ctx->lsm->domain, - &cmd_ctx->lsm->u.channel.chan, + ret = cmd_enable_channel(cmd_ctx->session, + ALIGNED_CONST_PTR(cmd_ctx->lsm->domain), + ALIGNED_CONST_PTR(cmd_ctx->lsm->u.channel.chan), kernel_poll_pipe[1]); break; } @@ -1320,7 +1320,7 @@ error_add_context: } } - ev = lttng_event_copy(&cmd_ctx->lsm->u.enable.event); + ev = lttng_event_copy(ALIGNED_CONST_PTR(cmd_ctx->lsm->u.enable.event)); if (!ev) { DBG("Failed to copy event: %s", cmd_ctx->lsm->u.enable.event.name); @@ -1344,7 +1344,8 @@ error_add_context: } } - ret = cmd_enable_event(cmd_ctx->session, &cmd_ctx->lsm->domain, + ret = cmd_enable_event(cmd_ctx->session, + ALIGNED_CONST_PTR(cmd_ctx->lsm->domain), cmd_ctx->lsm->u.enable.channel_name, ev, filter_expression, bytecode, exclusion, @@ -1716,7 +1717,8 @@ error_add_context: struct lttcomm_lttng_output_id reply; ret = cmd_snapshot_add_output(cmd_ctx->session, - &cmd_ctx->lsm->u.snapshot_output.output, &snapshot_id); + ALIGNED_CONST_PTR(cmd_ctx->lsm->u.snapshot_output.output), + &snapshot_id); if (ret != LTTNG_OK) { goto error; } @@ -1735,7 +1737,7 @@ error_add_context: case LTTNG_SNAPSHOT_DEL_OUTPUT: { ret = cmd_snapshot_del_output(cmd_ctx->session, - &cmd_ctx->lsm->u.snapshot_output.output); + ALIGNED_CONST_PTR(cmd_ctx->lsm->u.snapshot_output.output)); break; } case LTTNG_SNAPSHOT_LIST_OUTPUT: @@ -1764,7 +1766,7 @@ error_add_context: case LTTNG_SNAPSHOT_RECORD: { ret = cmd_snapshot_record(cmd_ctx->session, - &cmd_ctx->lsm->u.snapshot_record.output, + ALIGNED_CONST_PTR(cmd_ctx->lsm->u.snapshot_record.output), cmd_ctx->lsm->u.snapshot_record.wait); break; } diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index c17be934a..c2231f1b0 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -107,7 +107,7 @@ static uint64_t relayd_net_seq_idx; static int validate_ust_event_name(const char *); static int cmd_enable_event_internal(struct ltt_session *session, - struct lttng_domain *domain, + const struct lttng_domain *domain, char *channel_name, struct lttng_event *event, char *filter_expression, struct lttng_filter_bytecode *filter, @@ -1482,27 +1482,29 @@ error: * The wpipe arguments is used as a notifier for the kernel thread. */ int cmd_enable_channel(struct ltt_session *session, - struct lttng_domain *domain, struct lttng_channel *attr, int wpipe) + const struct lttng_domain *domain, const struct lttng_channel *_attr, int wpipe) { int ret; struct ltt_ust_session *usess = session->ust_session; struct lttng_ht *chan_ht; size_t len; + struct lttng_channel attr; assert(session); - assert(attr); + assert(_attr); assert(domain); - len = lttng_strnlen(attr->name, sizeof(attr->name)); + attr = *_attr; + len = lttng_strnlen(attr.name, sizeof(attr.name)); /* Validate channel name */ - if (attr->name[0] == '.' || - memchr(attr->name, '/', len) != NULL) { + if (attr.name[0] == '.' || + memchr(attr.name, '/', len) != NULL) { ret = LTTNG_ERR_INVALID_CHANNEL_NAME; goto end; } - DBG("Enabling channel %s for session %s", attr->name, session->name); + DBG("Enabling channel %s for session %s", attr.name, session->name); rcu_read_lock(); @@ -1521,8 +1523,8 @@ int cmd_enable_channel(struct ltt_session *session, * beacons for inactive streams. */ if (session->live_timer > 0) { - attr->attr.live_timer_interval = session->live_timer; - attr->attr.switch_timer_interval = 0; + attr.attr.live_timer_interval = session->live_timer; + attr.attr.switch_timer_interval = 0; } /* Check for feature support */ @@ -1534,8 +1536,8 @@ int cmd_enable_channel(struct ltt_session *session, WARN("Kernel tracer does not support buffer monitoring. " "Setting the monitor interval timer to 0 " "(disabled) for channel '%s' of session '%s'", - attr-> name, session->name); - lttng_channel_set_monitor_timer_interval(attr, 0); + attr.name, session->name); + lttng_channel_set_monitor_timer_interval(&attr, 0); } break; } @@ -1560,16 +1562,16 @@ int cmd_enable_channel(struct ltt_session *session, { struct ltt_kernel_channel *kchan; - kchan = trace_kernel_get_channel_by_name(attr->name, + kchan = trace_kernel_get_channel_by_name(attr.name, session->kernel_session); if (kchan == NULL) { if (session->snapshot.nb_output > 0 || session->snapshot_mode) { /* Enforce mmap output for snapshot sessions. */ - attr->attr.output = LTTNG_EVENT_MMAP; + attr.attr.output = LTTNG_EVENT_MMAP; } - ret = channel_kernel_create(session->kernel_session, attr, wpipe); - if (attr->name[0] != '\0') { + ret = channel_kernel_create(session->kernel_session, &attr, wpipe); + if (attr.name[0] != '\0') { session->kernel_session->has_non_default_channel = 1; } } else { @@ -1599,19 +1601,19 @@ int cmd_enable_channel(struct ltt_session *session, * adhered to. */ if (domain->type == LTTNG_DOMAIN_JUL) { - if (strncmp(attr->name, DEFAULT_JUL_CHANNEL_NAME, + if (strncmp(attr.name, DEFAULT_JUL_CHANNEL_NAME, LTTNG_SYMBOL_NAME_LEN)) { ret = LTTNG_ERR_INVALID_CHANNEL_NAME; goto error; } } else if (domain->type == LTTNG_DOMAIN_LOG4J) { - if (strncmp(attr->name, DEFAULT_LOG4J_CHANNEL_NAME, + if (strncmp(attr.name, DEFAULT_LOG4J_CHANNEL_NAME, LTTNG_SYMBOL_NAME_LEN)) { ret = LTTNG_ERR_INVALID_CHANNEL_NAME; goto error; } } else if (domain->type == LTTNG_DOMAIN_PYTHON) { - if (strncmp(attr->name, DEFAULT_PYTHON_CHANNEL_NAME, + if (strncmp(attr.name, DEFAULT_PYTHON_CHANNEL_NAME, LTTNG_SYMBOL_NAME_LEN)) { ret = LTTNG_ERR_INVALID_CHANNEL_NAME; goto error; @@ -1620,10 +1622,10 @@ int cmd_enable_channel(struct ltt_session *session, chan_ht = usess->domain_global.channels; - uchan = trace_ust_find_channel_by_name(chan_ht, attr->name); + uchan = trace_ust_find_channel_by_name(chan_ht, attr.name); if (uchan == NULL) { - ret = channel_ust_create(usess, attr, domain->buf_type); - if (attr->name[0] != '\0') { + ret = channel_ust_create(usess, &attr, domain->buf_type); + if (attr.name[0] != '\0') { usess->has_non_default_channel = 1; } } else { @@ -1636,7 +1638,7 @@ int cmd_enable_channel(struct ltt_session *session, goto error; } - if (ret == LTTNG_OK && attr->attr.output != LTTNG_EVENT_MMAP) { + if (ret == LTTNG_OK && attr.attr.output != LTTNG_EVENT_MMAP) { session->has_non_mmap_channel = true; } error: @@ -1649,11 +1651,11 @@ end: * Command LTTNG_DISABLE_EVENT processed by the client thread. */ int cmd_disable_event(struct ltt_session *session, - enum lttng_domain_type domain, char *channel_name, - struct lttng_event *event) + enum lttng_domain_type domain, const char *channel_name, + const struct lttng_event *event) { int ret; - char *event_name; + const char *event_name; DBG("Disable event command for event \'%s\'", event->name); @@ -1826,7 +1828,7 @@ error: * Command LTTNG_ADD_CONTEXT processed by the client thread. */ int cmd_add_context(struct ltt_session *session, enum lttng_domain_type domain, - char *channel_name, struct lttng_event_context *ctx, int kwpipe) + char *channel_name, const struct lttng_event_context *ctx, int kwpipe) { int ret, chan_kern_created = 0, chan_ust_created = 0; char *app_ctx_provider_name = NULL, *app_ctx_name = NULL; @@ -1997,7 +1999,7 @@ end: * enable the events through which all "agent" events are funeled. */ static int _cmd_enable_event(struct ltt_session *session, - struct lttng_domain *domain, + const struct lttng_domain *domain, char *channel_name, struct lttng_event *event, char *filter_expression, struct lttng_filter_bytecode *filter, @@ -2394,7 +2396,8 @@ error: * Command LTTNG_ENABLE_EVENT processed by the client thread. * We own filter, exclusion, and filter_expression. */ -int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, +int cmd_enable_event(struct ltt_session *session, + const struct lttng_domain *domain, char *channel_name, struct lttng_event *event, char *filter_expression, struct lttng_filter_bytecode *filter, @@ -2411,7 +2414,7 @@ int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, * reserved names. */ static int cmd_enable_event_internal(struct ltt_session *session, - struct lttng_domain *domain, + const struct lttng_domain *domain, char *channel_name, struct lttng_event *event, char *filter_expression, struct lttng_filter_bytecode *filter, @@ -3712,7 +3715,7 @@ error: * Return LTTNG_OK on success or else a LTTNG_ERR code. */ int cmd_snapshot_add_output(struct ltt_session *session, - struct lttng_snapshot_output *output, uint32_t *id) + const struct lttng_snapshot_output *output, uint32_t *id) { int ret; struct snapshot_output *new_output; @@ -3780,7 +3783,7 @@ error: * Return LTTNG_OK on success or else a LTTNG_ERR code. */ int cmd_snapshot_del_output(struct ltt_session *session, - struct lttng_snapshot_output *output) + const struct lttng_snapshot_output *output) { int ret; struct snapshot_output *sout = NULL; @@ -4608,7 +4611,7 @@ error: * Return LTTNG_OK on success or else a LTTNG_ERR code. */ int cmd_snapshot_record(struct ltt_session *session, - struct lttng_snapshot_output *output, int wait) + const struct lttng_snapshot_output *output, int wait) { enum lttng_error_code cmd_ret = LTTNG_OK; int ret; diff --git a/src/bin/lttng-sessiond/cmd.h b/src/bin/lttng-sessiond/cmd.h index 5ac24a506..32fb7fa60 100644 --- a/src/bin/lttng-sessiond/cmd.h +++ b/src/bin/lttng-sessiond/cmd.h @@ -54,7 +54,7 @@ int cmd_destroy_session(struct ltt_session *session, int cmd_disable_channel(struct ltt_session *session, enum lttng_domain_type domain, char *channel_name); int cmd_enable_channel(struct ltt_session *session, - struct lttng_domain *domain, struct lttng_channel *attr, + const struct lttng_domain *domain, const struct lttng_channel *attr, int wpipe); int cmd_track_pid(struct ltt_session *session, enum lttng_domain_type domain, int pid); @@ -64,14 +64,14 @@ int cmd_untrack_pid(struct ltt_session *session, enum lttng_domain_type domain, /* Event commands */ int cmd_disable_event(struct ltt_session *session, enum lttng_domain_type domain, - char *channel_name, - struct lttng_event *event); + const char *channel_name, + const struct lttng_event *event); int cmd_add_context(struct ltt_session *session, enum lttng_domain_type domain, - char *channel_name, struct lttng_event_context *ctx, int kwpipe); + char *channel_name, const struct lttng_event_context *ctx, int kwpipe); int cmd_set_filter(struct ltt_session *session, enum lttng_domain_type domain, char *channel_name, struct lttng_event *event, struct lttng_filter_bytecode *bytecode); -int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, +int cmd_enable_event(struct ltt_session *session, const struct lttng_domain *domain, char *channel_name, struct lttng_event *event, char *filter_expression, struct lttng_filter_bytecode *filter, @@ -116,11 +116,11 @@ int cmd_data_pending(struct ltt_session *session); /* Snapshot */ int cmd_snapshot_add_output(struct ltt_session *session, - struct lttng_snapshot_output *output, uint32_t *id); + const struct lttng_snapshot_output *output, uint32_t *id); int cmd_snapshot_del_output(struct ltt_session *session, - struct lttng_snapshot_output *output); + const struct lttng_snapshot_output *output); int cmd_snapshot_record(struct ltt_session *session, - struct lttng_snapshot_output *output, int wait); + const struct lttng_snapshot_output *output, int wait); int cmd_set_session_shm_path(struct ltt_session *session, const char *shm_path); diff --git a/src/bin/lttng-sessiond/context.c b/src/bin/lttng-sessiond/context.c index 3861d22c1..8a43cb7c1 100644 --- a/src/bin/lttng-sessiond/context.c +++ b/src/bin/lttng-sessiond/context.c @@ -107,7 +107,8 @@ error: */ static int add_uctx_to_channel(struct ltt_ust_session *usess, enum lttng_domain_type domain, - struct ltt_ust_channel *uchan, struct lttng_event_context *ctx) + struct ltt_ust_channel *uchan, + const struct lttng_event_context *ctx) { int ret; struct ltt_ust_context *uctx = NULL; @@ -196,7 +197,7 @@ duplicate: * Add kernel context to tracer. */ int context_kernel_add(struct ltt_kernel_session *ksession, - struct lttng_event_context *ctx, char *channel_name) + const struct lttng_event_context *ctx, char *channel_name) { int ret; struct ltt_kernel_channel *kchan; @@ -313,7 +314,8 @@ error: * Add UST context to tracer. */ int context_ust_add(struct ltt_ust_session *usess, - enum lttng_domain_type domain, struct lttng_event_context *ctx, + enum lttng_domain_type domain, + const struct lttng_event_context *ctx, char *channel_name) { int ret = LTTNG_OK; diff --git a/src/bin/lttng-sessiond/context.h b/src/bin/lttng-sessiond/context.h index 01b35167e..e9de999c4 100644 --- a/src/bin/lttng-sessiond/context.h +++ b/src/bin/lttng-sessiond/context.h @@ -25,9 +25,10 @@ #include "ust-ctl.h" int context_kernel_add(struct ltt_kernel_session *ksession, - struct lttng_event_context *ctx, char *channel_name); + const struct lttng_event_context *ctx, char *channel_name); int context_ust_add(struct ltt_ust_session *usess, - enum lttng_domain_type domain, struct lttng_event_context *ctx, + enum lttng_domain_type domain, + const struct lttng_event_context *ctx, char *channel_name); #endif /* _LTT_CONTEXT_H */ diff --git a/src/bin/lttng-sessiond/event.c b/src/bin/lttng-sessiond/event.c index f4b976f3b..f32db4429 100644 --- a/src/bin/lttng-sessiond/event.c +++ b/src/bin/lttng-sessiond/event.c @@ -69,7 +69,7 @@ static void add_unique_ust_event(struct lttng_ht *ht, * If event_name is NULL all events of the specified type are disabled. */ int event_kernel_disable_event(struct ltt_kernel_channel *kchan, - char *event_name, enum lttng_event_type type) + const char *event_name, enum lttng_event_type type) { int ret, error = 0, found = 0; struct ltt_kernel_event *kevent; @@ -259,7 +259,7 @@ error: * Disable UST tracepoint of a channel from a UST session. */ int event_ust_disable_tracepoint(struct ltt_ust_session *usess, - struct ltt_ust_channel *uchan, char *event_name) + struct ltt_ust_channel *uchan, const char *event_name) { int ret; struct ltt_ust_event *uevent; @@ -672,7 +672,7 @@ error: * Return LTTNG_OK on success or else a LTTNG_ERR* code. */ int event_agent_disable(struct ltt_ust_session *usess, struct agent *agt, - char *event_name) + const char *event_name) { int ret = LTTNG_OK; struct agent_event *aevent; diff --git a/src/bin/lttng-sessiond/event.h b/src/bin/lttng-sessiond/event.h index 45dd1fcbb..d0b1b9dab 100644 --- a/src/bin/lttng-sessiond/event.h +++ b/src/bin/lttng-sessiond/event.h @@ -23,7 +23,7 @@ struct agent; int event_kernel_disable_event(struct ltt_kernel_channel *kchan, - char *event_name, enum lttng_event_type event_type); + const char *event_name, enum lttng_event_type event_type); int event_kernel_enable_event(struct ltt_kernel_channel *kchan, struct lttng_event *event, char *filter_expression, @@ -36,7 +36,7 @@ int event_ust_enable_tracepoint(struct ltt_ust_session *usess, struct lttng_event_exclusion *exclusion, bool internal_event); int event_ust_disable_tracepoint(struct ltt_ust_session *usess, - struct ltt_ust_channel *uchan, char *event_name); + struct ltt_ust_channel *uchan, const char *event_name); int event_ust_disable_all_tracepoints(struct ltt_ust_session *usess, struct ltt_ust_channel *uchan); @@ -49,7 +49,7 @@ int event_agent_enable_all(struct ltt_ust_session *usess, struct agent *agt, char *filter_expression); int event_agent_disable(struct ltt_ust_session *usess, struct agent *agt, - char *event_name); + const char *event_name); int event_agent_disable_all(struct ltt_ust_session *usess, struct agent *agt); const char *event_get_default_agent_ust_name(enum lttng_domain_type domain); diff --git a/src/bin/lttng-sessiond/trace-kernel.c b/src/bin/lttng-sessiond/trace-kernel.c index 36af00b2d..e0491c95b 100644 --- a/src/bin/lttng-sessiond/trace-kernel.c +++ b/src/bin/lttng-sessiond/trace-kernel.c @@ -39,7 +39,7 @@ * Find the channel name for the given kernel session. */ struct ltt_kernel_channel *trace_kernel_get_channel_by_name( - char *name, struct ltt_kernel_session *session) + const char *name, struct ltt_kernel_session *session) { struct ltt_kernel_channel *chan; diff --git a/src/bin/lttng-sessiond/trace-kernel.h b/src/bin/lttng-sessiond/trace-kernel.h index 3b211740a..e439c31cd 100644 --- a/src/bin/lttng-sessiond/trace-kernel.h +++ b/src/bin/lttng-sessiond/trace-kernel.h @@ -135,7 +135,7 @@ struct ltt_kernel_event *trace_kernel_find_event( enum lttng_event_type type, struct lttng_filter_bytecode *filter); struct ltt_kernel_channel *trace_kernel_get_channel_by_name( - char *name, struct ltt_kernel_session *session); + const char *name, struct ltt_kernel_session *session); /* * Create functions malloc() the data structure. diff --git a/src/bin/lttng-sessiond/trace-ust.c b/src/bin/lttng-sessiond/trace-ust.c index 569599af2..cc166fd6f 100644 --- a/src/bin/lttng-sessiond/trace-ust.c +++ b/src/bin/lttng-sessiond/trace-ust.c @@ -171,7 +171,7 @@ no_match: * lock MUST be acquired before calling this. */ struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht, - char *name) + const char *name) { struct lttng_ht_node_str *node; struct lttng_ht_iter iter; @@ -574,8 +574,8 @@ int trace_ust_context_type_event_to_ust( /* * Return 1 if contexts match, 0 otherwise. */ -int trace_ust_match_context(struct ltt_ust_context *uctx, - struct lttng_event_context *ctx) +int trace_ust_match_context(const struct ltt_ust_context *uctx, + const struct lttng_event_context *ctx) { int utype; @@ -624,7 +624,7 @@ int trace_ust_match_context(struct ltt_ust_context *uctx, * Return pointer to structure or NULL. */ struct ltt_ust_context *trace_ust_create_context( - struct lttng_event_context *ctx) + const struct lttng_event_context *ctx) { struct ltt_ust_context *uctx = NULL; int utype; diff --git a/src/bin/lttng-sessiond/trace-ust.h b/src/bin/lttng-sessiond/trace-ust.h index 9316fa817..89088ec03 100644 --- a/src/bin/lttng-sessiond/trace-ust.h +++ b/src/bin/lttng-sessiond/trace-ust.h @@ -187,7 +187,7 @@ struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht, enum lttng_ust_loglevel_type loglevel_type, int loglevel_value, struct lttng_event_exclusion *exclusion); struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht, - char *name); + const char *name); struct agent *trace_ust_find_agent(struct ltt_ust_session *session, enum lttng_domain_type domain_type); @@ -203,9 +203,9 @@ enum lttng_error_code trace_ust_create_event(struct lttng_event *ev, struct lttng_event_exclusion *exclusion, bool internal_event, struct ltt_ust_event **ust_event); struct ltt_ust_context *trace_ust_create_context( - struct lttng_event_context *ctx); -int trace_ust_match_context(struct ltt_ust_context *uctx, - struct lttng_event_context *ctx); + const struct lttng_event_context *ctx); +int trace_ust_match_context(const struct ltt_ust_context *uctx, + const struct lttng_event_context *ctx); void trace_ust_delete_channel(struct lttng_ht *ht, struct ltt_ust_channel *channel); @@ -241,7 +241,7 @@ static inline int trace_ust_ht_match_event_by_name(struct cds_lfht_node *node, } static inline struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht, - char *name) + const char *name) { return NULL; } @@ -288,13 +288,13 @@ void trace_ust_free_session(struct ltt_ust_session *session) static inline struct ltt_ust_context *trace_ust_create_context( - struct lttng_event_context *ctx) + const struct lttng_event_context *ctx) { return NULL; } static inline -int trace_ust_match_context(struct ltt_ust_context *uctx, - struct lttng_event_context *ctx) +int trace_ust_match_context(const struct ltt_ust_context *uctx, + const struct lttng_event_context *ctx) { return 0; }