[lttng-dev] [LTTNG-TOOLS PATCH] Fix: only cleanup the agent_apps_ht_by_sock as root

Julien Desfossez jdesfossez at efficios.com
Thu Jul 30 11:12:37 EDT 2015


Commit 6a4e403927ffef4cae8726064dcf53c463eb128c introduced a bug where
we could end up iterating over the agent_apps_ht_by_sock regardless if
it was allocated or not (only when the sessiond is launched as root).

Steps to reproduce:
$ sudo lttng-sessiond -d
$ lttng-sessiond
Error: Already running daemon.
Segmentation fault (core dumped)

Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
 src/bin/lttng-sessiond/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c
index 91dd047..5840165 100644
--- a/src/bin/lttng-sessiond/main.c
+++ b/src/bin/lttng-sessiond/main.c
@@ -677,7 +677,9 @@ static void sessiond_cleanup(void)
 	}
 
 	DBG("Cleaning up all agent apps");
-	agent_app_ht_clean();
+	if (is_root) {
+		agent_app_ht_clean();
+	}
 
 	DBG("Closing all UST sockets");
 	ust_app_clean_list();
-- 
1.9.1




More information about the lttng-dev mailing list