From: Mathieu Desnoyers Date: Wed, 25 May 2016 21:19:35 +0000 (-0400) Subject: Fix: initialize RCU callbacks with mixed LGPL/non-LGPL objects X-Git-Tag: v2.9.0-rc1~82 X-Git-Url: http://git.lttng.org./?a=commitdiff_plain;h=8f0d1c78f5c8a236b52dc545e5a51fdc741ae7d2;hp=32855a09dc8925f578624cab645a33ecb139389c;p=lttng-ust.git Fix: initialize RCU callbacks with mixed LGPL/non-LGPL objects Linking both _LGPL_SOURCE and non-_LGPL_SOURCE objects into the same module may result in having the RCU callbacks left to NULL, which prevents tracing for tracepoints and/or probes which sit in the non-LGPL compile unit. This happens if the contructor of the LGPL compile unit is executed first, thus incrementing the __tracepoint_registered counter, which will prevent later execution of that same constructor in the non-LGPL compile unit to initialize the RCU callbacks in __tracepoint__init_urcu_sym(). Signed-off-by: Jérémie Galarneau Signed-off-by: Mathieu Desnoyers --- diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h index a7305603..03bc913f 100644 --- a/include/lttng/tracepoint.h +++ b/include/lttng/tracepoint.h @@ -309,8 +309,12 @@ __tracepoints__init(void); static void __tracepoints__init(void) { - if (__tracepoint_registered++) + if (__tracepoint_registered++) { + if (!tracepoint_dlopen_ptr->liblttngust_handle) + return; + __tracepoint__init_urcu_sym(); return; + } if (!tracepoint_dlopen_ptr) tracepoint_dlopen_ptr = &tracepoint_dlopen;