From: Mathieu Desnoyers Date: Thu, 10 Mar 2016 00:37:56 +0000 (-0500) Subject: Fix: application context header size X-Git-Tag: v2.8.0-rc1~7 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ba1c40c6095cdcb25c9c3be8bd72b09755f1f116;p=lttng-ust.git Fix: application context header size We need to use the RCU-dereferenced pointer when calculating the context header size, else it may race with application context register/unregister. Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust/lttng-ring-buffer-client.h b/liblttng-ust/lttng-ring-buffer-client.h index 97e1f440..1ebb14e4 100644 --- a/liblttng-ust/lttng-ring-buffer-client.h +++ b/liblttng-ust/lttng-ring-buffer-client.h @@ -118,7 +118,7 @@ size_t record_header_size(const struct lttng_ust_lib_ring_buffer_config *config, struct lttng_ust_lib_ring_buffer_ctx *ctx) { struct lttng_channel *lttng_chan = channel_get_private(chan); - struct lttng_event *event = ctx->priv; + struct lttng_stack_ctx *lttng_ctx = ctx->priv2; size_t orig_offset = offset; size_t padding; @@ -157,8 +157,8 @@ size_t record_header_size(const struct lttng_ust_lib_ring_buffer_config *config, padding = 0; WARN_ON_ONCE(1); } - offset += ctx_get_size(offset, lttng_chan->ctx); - offset += ctx_get_size(offset, event->ctx); + offset += ctx_get_size(offset, lttng_ctx->chan_ctx); + offset += ctx_get_size(offset, lttng_ctx->event_ctx); *pre_header_padding = padding; return offset - orig_offset;