summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
bcfa8a0)
Failing to create metadata, the data structure was freed but the pointer
was not set to NULL. When deleting the metadata of that session (that
has failed), the pointer was not NULL creating a "valid" pointer for the
check and creating a double free error. This failure happens when the
session daemon reached the maximum number of open files.
Also, on destroy trace, the ust app session was freed and deref. just
after creating an invalid pointer access.
Finally, set the started flag of a ust app session to 0 when stopping
the session.
Signed-off-by: David Goulet <dgoulet@efficios.com>
ret = open_ust_metadata(app, ua_sess);
if (ret < 0) {
ret = open_ust_metadata(app, ua_sess);
if (ret < 0) {
+ DBG3("Opening metadata failed. Cleaning up memory");
+
/* Cleanup failed metadata struct */
free(ua_sess->metadata);
/* Cleanup failed metadata struct */
free(ua_sess->metadata);
+ /*
+ * This is very important because delete_ust_app_session check if
+ * the pointer is null or not in order to delete the metadata.
+ */
+ ua_sess->metadata = NULL;
+ /* Not started, continuing. */
+ if (ua_sess->started == 0) {
+ goto end;
+ }
+
/* This inhibits UST tracing */
ret = ustctl_stop_session(app->key.sock, ua_sess->handle);
if (ret < 0) {
/* This inhibits UST tracing */
ret = ustctl_stop_session(app->key.sock, ua_sess->handle);
if (ret < 0) {
node.node) {
ret = ustctl_sock_flush_buffer(app->key.sock, ua_chan->obj);
if (ret < 0) {
node.node) {
ret = ustctl_sock_flush_buffer(app->key.sock, ua_chan->obj);
if (ret < 0) {
- ERR("UST app PID %d channel %s flush failed",
- app->key.pid, ua_chan->name);
- ERR("Ended with ret %d", ret);
+ ERR("UST app PID %d channel %s flush failed with ret %d",
+ app->key.pid, ua_chan->name, ret);
/* Continuing flushing all buffers */
continue;
}
/* Continuing flushing all buffers */
continue;
}
/* Flush all buffers before stopping */
ret = ustctl_sock_flush_buffer(app->key.sock, ua_sess->metadata->obj);
if (ret < 0) {
/* Flush all buffers before stopping */
ret = ustctl_sock_flush_buffer(app->key.sock, ua_sess->metadata->obj);
if (ret < 0) {
- ERR("UST app PID %d metadata flush failed", app->key.pid);
- ERR("Ended with ret %d", ret);
+ ERR("UST app PID %d metadata flush failed with ret %d", app->key.pid,
+ ret);
+end:
+ rcu_read_unlock();
return 0;
error_rcu_unlock:
return 0;
error_rcu_unlock:
ua_sess = caa_container_of(node, struct ust_app_session, node);
ret = lttng_ht_del(app->sessions, &iter);
assert(!ret);
ua_sess = caa_container_of(node, struct ust_app_session, node);
ret = lttng_ht_del(app->sessions, &iter);
assert(!ret);
- delete_ust_app_session(app->key.sock, ua_sess);
obj.handle = ua_sess->handle;
obj.shm_fd = -1;
obj.wait_fd = -1;
obj.memory_map_size = 0;
ustctl_release_object(app->key.sock, &obj);
obj.handle = ua_sess->handle;
obj.shm_fd = -1;
obj.wait_fd = -1;
obj.memory_map_size = 0;
ustctl_release_object(app->key.sock, &obj);
+ delete_ust_app_session(app->key.sock, ua_sess);
+
rcu_read_unlock();
/* Quiescent wait after stopping trace */
rcu_read_unlock();
/* Quiescent wait after stopping trace */