From a58c831a07058055a6e14d09d0e5a3f40f47eae3 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 10 Dec 2020 10:07:24 -0500 Subject: [PATCH] Fix: ust-urcu: allow legacy applications without _LGPL_SOURCE Allow legacy instrumented applications without _LGPL_SOURCE to use the legacy v1 tracepoint registration API without requiring the liburcu-bp symbols to be present in the symbol table. Signed-off-by: Mathieu Desnoyers Change-Id: Iaa574647442254b34682ea36b858a30e2ecdf98e --- liblttng-ust/tracepoint.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/liblttng-ust/tracepoint.c b/liblttng-ust/tracepoint.c index cf7cf63c..ce7dbbb2 100644 --- a/liblttng-ust/tracepoint.c +++ b/liblttng-ust/tracepoint.c @@ -175,8 +175,22 @@ static void lttng_ust_tracepoint_set_v1_used(void) if (!lttng_ust_liburcu_bp_synchronize_rcu) { lttng_ust_liburcu_bp_synchronize_rcu = URCU_FORCE_CAST(void (*)(void), dlsym(RTLD_DEFAULT, "synchronize_rcu_bp")); + /* + * Allow legacy applications compiled without + * _LGPL_SOURCE to use v1 API. Those are not + * required to be linked against liburcu-bp, + * so in those situations the liburcu-bp symbols + * are not present in the global symbol table, + * and we do not need to call urcu-bp + * synchronize. + * + * However, nothing prevents a _LGPL_SOURCE + * instrumented library loaded afterwards to + * require liburcu-bp, so we need to check again + * in that situation. + */ if (!lttng_ust_liburcu_bp_synchronize_rcu) - abort(); + return; } if (!lttng_ust_liburcu_bp_before_fork) { lttng_ust_liburcu_bp_before_fork = URCU_FORCE_CAST(void (*)(void), -- 2.34.1