From 1b0bebcb6f1a5230aedfcbab78623bb5eac633d5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 17 Jul 2019 15:12:49 -0400 Subject: [PATCH] Create userspace buffers using ua_sess effective credentials MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit While a session's trace chunk shares its credentials, a trace chunk's credentials are unset when the output is not local. Hence, the session's effective credentials must be used. Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/consumer.c | 14 ++++---------- src/bin/lttng-sessiond/consumer.h | 3 ++- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index 83c30be86..1bbee02f2 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -883,7 +883,8 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg, int64_t blocking_timeout, const char *root_shm_path, const char *shm_path, - struct lttng_trace_chunk *trace_chunk) + struct lttng_trace_chunk *trace_chunk, + const struct lttng_credentials *buffer_credentials) { assert(msg); @@ -899,20 +900,13 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg, if (trace_chunk) { uint64_t chunk_id; enum lttng_trace_chunk_status chunk_status; - struct lttng_credentials chunk_credentials; chunk_status = lttng_trace_chunk_get_id(trace_chunk, &chunk_id); assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK); LTTNG_OPTIONAL_SET(&msg->u.ask_channel.chunk_id, chunk_id); - - chunk_status = lttng_trace_chunk_get_credentials(trace_chunk, - &chunk_credentials); - assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK); - msg->u.ask_channel.buffer_credentials.uid = - chunk_credentials.uid; - msg->u.ask_channel.buffer_credentials.gid = - chunk_credentials.gid; } + msg->u.ask_channel.buffer_credentials.uid = buffer_credentials->uid; + msg->u.ask_channel.buffer_credentials.gid = buffer_credentials->gid; msg->cmd_type = LTTNG_CONSUMER_ASK_CHANNEL_CREATION; msg->u.ask_channel.subbuf_size = subbuf_size; diff --git a/src/bin/lttng-sessiond/consumer.h b/src/bin/lttng-sessiond/consumer.h index cf6fe48c9..13ebcd035 100644 --- a/src/bin/lttng-sessiond/consumer.h +++ b/src/bin/lttng-sessiond/consumer.h @@ -256,7 +256,8 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg, int64_t blocking_timeout, const char *root_shm_path, const char *shm_path, - struct lttng_trace_chunk *trace_chunk); + struct lttng_trace_chunk *trace_chunk, + const struct lttng_credentials *buffer_credentials); void consumer_init_add_stream_comm_msg(struct lttcomm_consumer_msg *msg, uint64_t channel_key, uint64_t stream_key, -- 2.34.1