<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 30, 2015 at 11:12 AM, Julien Desfossez <span dir="ltr"><<a href="mailto:jdesfossez@efficios.com" target="_blank">jdesfossez@efficios.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Commit 6a4e403927ffef4cae8726064dcf53c463eb128c introduced a bug where<br>
we could end up iterating over the agent_apps_ht_by_sock regardless if<br>
it was allocated or not (only when the sessiond is launched as root).<br>
<br>
Steps to reproduce:<br>
$ sudo lttng-sessiond -d<br>
$ lttng-sessiond<br>
Error: Already running daemon.<br>
Segmentation fault (core dumped)<br>
<br>
Signed-off-by: Julien Desfossez <<a href="mailto:jdesfossez@efficios.com">jdesfossez@efficios.com</a>><br>
---<br>
 src/bin/lttng-sessiond/main.c | 4 +++-<br>
 1 file changed, 3 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c<br>
index 91dd047..5840165 100644<br>
--- a/src/bin/lttng-sessiond/main.c<br>
+++ b/src/bin/lttng-sessiond/main.c<br>
@@ -677,7 +677,9 @@ static void sessiond_cleanup(void)<br>
        }<br>
<br>
        DBG("Cleaning up all agent apps");<br>
-       agent_app_ht_clean();<br>
+       if (is_root) {<br>
+               agent_app_ht_clean();<br>
+       }<br>
<br></blockquote><div><br></div><div>This will leak the hash table if the session daemon was launched as an unprivileged user. However, the problem can also be reproduced by launching two session daemons under the same unprivileged user.</div><div><br></div><div>The real issue here seems to be that the session daemon will enter the "exit_init_data" code path before creating the hash table if it can't acquire the lock file and that there are no NULL checks performed during the sessiond_cleanup().</div><div><br></div><div>Thanks,</div><div>Jérémie</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
        DBG("Closing all UST sockets");<br>
        ust_app_clean_list();<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.9.1<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Jérémie Galarneau<br>EfficiOS Inc.<br><a href="http://www.efficios.com" target="_blank">http://www.efficios.com</a></div>
</div></div>