[lttng-dev] [PATCH lttng-tools] Tests: Fix possible segfault in health check thread exit test

Christian Babeux christian.babeux at efficios.com
Wed May 22 16:29:33 EDT 2013


The testpoints in the thread_manage_clients and thread_manage_apps
are called after a rcu_register_thread() call. The testpoints were
not unregistering their respective thread which could later on cause
a segfault when shutting down the session daemon.

Signed-off-by: Christian Babeux <christian.babeux at efficios.com>
---
 tests/regression/tools/health/health_exit.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/regression/tools/health/health_exit.c b/tests/regression/tools/health/health_exit.c
index 8e41405..8d1d05c 100644
--- a/tests/regression/tools/health/health_exit.c
+++ b/tests/regression/tools/health/health_exit.c
@@ -18,6 +18,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <pthread.h>
+#include <urcu.h>
 
 /*
  * Check if the specified environment variable is set.
@@ -40,6 +41,7 @@ int __testpoint_thread_manage_clients(void)
 	const char *var = "LTTNG_THREAD_MANAGE_CLIENTS_EXIT";
 
 	if (check_env_var(var)) {
+		rcu_unregister_thread();
 		pthread_exit(NULL);
 	}
 
@@ -62,6 +64,7 @@ int __testpoint_thread_manage_apps(void)
 	const char *var = "LTTNG_THREAD_MANAGE_APPS_EXIT";
 
 	if (check_env_var(var)) {
+		rcu_unregister_thread();
 		pthread_exit(NULL);
 	}
 
-- 
1.8.2.2




More information about the lttng-dev mailing list