Fix: lttng-ust 2.13 should not try to use notifiers from 2.12 or prior probes
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 17 Dec 2020 19:36:54 +0000 (14:36 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 17 Dec 2020 19:50:20 +0000 (14:50 -0500)
Probe providers built against lttng-ust 2.12 or prior do not implement
the event notifier callback, and accessing desc->u.ext.event_notifier_callback
accesses beyond the size of struct lttng_event_desc.

Therefore, skip those older probe providers from the list of providers
considered for event notifications, and print an error when this
situation is encountered.

Currently, the error reporting of lttng-ust is performed through ERR(),
which is only observable on the console of the application when run with
LTTNG_UST_DEBUG=1.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ia8a9bae1a471ae5d30ff0364b28e1cd3a8b4e396

liblttng-ust/lttng-events.c

index 53bb1100cab922b7fd86a0349c69ce3b057bfb98..16d75da95b0c265d4785ca61de0513caa29476eb 100644 (file)
@@ -1708,6 +1708,13 @@ void lttng_session_sync_event_enablers(struct lttng_session *session)
        __tracepoint_probe_prune_release_queue();
 }
 
+/* Support for event notifier is introduced by probe provider major version 2. */
+static
+bool lttng_ust_probe_supports_event_notifier(struct lttng_probe_desc *probe_desc)
+{
+       return probe_desc->major >= 2;
+}
+
 static
 void lttng_create_event_notifier_if_missing(
                struct lttng_event_notifier_enabler *event_notifier_enabler)
@@ -1759,6 +1766,18 @@ void lttng_create_event_notifier_if_missing(
                        if (found)
                                continue;
 
+                       /* Check that the probe supports event notifiers, else report the error. */
+                       if (!lttng_ust_probe_supports_event_notifier(probe_desc)) {
+                               ERR("Probe \"%s\" contains event \"%s\" which matches an enabled event notifier, "
+                                       "but its version (%u.%u) is too old and does not implement event notifiers. "
+                                       "It needs to be recompiled against a newer version of LTTng-UST, otherwise "
+                                       "this event will not generate any notification.",
+                                       probe_desc->provider,
+                                       desc->name,
+                                       probe_desc->major,
+                                       probe_desc->minor);
+                               continue;
+                       }
                        /*
                         * We need to create a event_notifier for this event probe.
                         */
This page took 0.035559 seconds and 4 git commands to generate.