uint64_t tracefile_size,
uint64_t tracefile_count,
uint64_t session_id_per_pid,
- unsigned int monitor)
+ unsigned int monitor,
+ uint32_t ust_app_uid)
{
assert(msg);
msg->u.ask_channel.tracefile_size = tracefile_size;
msg->u.ask_channel.tracefile_count = tracefile_count;
msg->u.ask_channel.monitor = monitor;
+ msg->u.ask_channel.ust_app_uid = ust_app_uid;
memcpy(msg->u.ask_channel.uuid, uuid, sizeof(msg->u.ask_channel.uuid));
uint64_t tracefile_size,
uint64_t tracefile_count,
uint64_t session_id_per_pid,
- unsigned int monitor);
+ unsigned int monitor,
+ uint32_t ust_app_uid);
void consumer_init_stream_comm_msg(struct lttcomm_consumer_msg *msg,
enum lttng_consumer_command cmd,
uint64_t channel_key,
ua_chan->tracefile_size,
ua_chan->tracefile_count,
ua_sess->id,
- ua_sess->output_traces);
+ ua_sess->output_traces,
+ ua_sess->uid);
health_code_update();
char pathname[PATH_MAX];
/* Channel name. */
char name[LTTNG_SYMBOL_NAME_LEN];
- /* UID and GID of the channel. */
+ /* UID and GID of the session owning this channel. */
uid_t uid;
gid_t gid;
/* Relayd id of the channel. -1ULL if it does not apply. */
enum consumer_channel_type type;
/* For UST */
+ uid_t ust_app_uid; /* Application UID. */
struct ustctl_consumer_channel *uchan;
unsigned char uuid[UUID_STR_LEN];
/*
uint64_t session_id_per_pid; /* Per-pid session ID. */
/* Tells the consumer if the stream should be or not monitored. */
uint32_t monitor;
+ /*
+ * For UST per UID buffers, this is the application UID of the
+ * channel. This can be different from the user UID requesting the
+ * channel creation and used for the rights on the stream file
+ * because the application can be in the tracing for instance.
+ */
+ uint32_t ust_app_uid;
} LTTNG_PACKED ask_channel;
struct {
uint64_t key;
goto end_channel_error;
}
+ /*
+ * Assign UST application UID to the channel. This value is ignored for
+ * per PID buffers. This is specific to UST thus setting this after the
+ * allocation.
+ */
+ channel->ust_app_uid = msg.u.ask_channel.ust_app_uid;
+
/* Build channel attributes from received message. */
attr.subbuf_size = msg.u.ask_channel.subbuf_size;
attr.num_subbuf = msg.u.ask_channel.num_subbuf;
request.session_id = channel->session_id;
request.session_id_per_pid = channel->session_id_per_pid;
- request.uid = channel->uid;
+ /*
+ * Request the application UID here so the metadata of that application can
+ * be sent back. The channel UID corresponds to the user UID of the session
+ * used for the rights on the stream file(s).
+ */
+ request.uid = channel->ust_app_uid;
request.key = channel->key;
+
DBG("Sending metadata request to sessiond, session id %" PRIu64
- ", per-pid %" PRIu64,
- channel->session_id,
- channel->session_id_per_pid);
+ ", per-pid %" PRIu64 ", app UID %u and channek key %" PRIu64,
+ request.session_id, request.session_id_per_pid, request.uid,
+ request.key);
pthread_mutex_lock(&ctx->metadata_socket_lock);
ret = lttcomm_send_unix_sock(ctx->consumer_metadata_socket, &request,