From: Jérémie Galarneau Date: Wed, 17 Jul 2019 19:12:49 +0000 (-0400) Subject: Create userspace buffers using ua_sess effective credentials X-Git-Tag: v2.11.0-rc3~100 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ce7fb97ac50adb59d59c57cad3f4c4d0001bc457;p=lttng-tools.git Create userspace buffers using ua_sess effective credentials 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 --- 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,