Fix: Add signature check in tracepoint activation
[lttng-ust.git] / liblttng-ust / ltt-events.c
index 9d5d882794dbe9a555405a3c0f0f84b8714f93b0..ce4c2bb01719baab3b8bbf0f52fded018881bfef 100644 (file)
@@ -279,7 +279,7 @@ int pending_probe_fix_events(const struct lttng_event_desc *desc)
                remove_pending_probe(e);
                ret |= __tracepoint_probe_register(name,
                                event->desc->probe_callback,
-                               event);
+                               event, event->desc->signature);
                if (ret)
                        continue;
                event->id = chan->free_event_id++;
@@ -493,7 +493,7 @@ int ltt_event_create(struct ltt_channel *chan,
        struct ltt_event *event;
        int ret = 0;
 
-       if (chan->used_event_id == -1UL) {
+       if (chan->used_event_id == -1U) {
                ret = -ENOMEM;
                goto full;
        }
@@ -550,7 +550,7 @@ int ltt_event_create(struct ltt_channel *chan,
                if (event->desc) {
                        ret = __tracepoint_probe_register(event_param->name,
                                        event->desc->probe_callback,
-                                       event);
+                                       event, event->desc->signature);
                        if (ret)
                                goto register_error;
                        event->id = chan->free_event_id++;
@@ -878,6 +878,7 @@ int _ltt_event_metadata_statedump(struct ltt_session *session,
                                  struct ltt_event *event)
 {
        int ret = 0;
+       int loglevel = TRACE_DEFAULT;
 
        if (event->metadata_dumped || !CMM_ACCESS_ONCE(session->active))
                return 0;
@@ -900,13 +901,14 @@ int _ltt_event_metadata_statedump(struct ltt_session *session,
        if (ret)
                goto end;
 
-       if (event->desc->loglevel) {
-               ret = lttng_metadata_printf(session,
-                       "       loglevel = %d;\n",
-                       *(*event->desc->loglevel));
-               if (ret)
-                       goto end;
-       }
+       if (event->desc->loglevel)
+               loglevel = *(*event->desc->loglevel);
+
+       ret = lttng_metadata_printf(session,
+               "       loglevel = %d;\n",
+               loglevel);
+       if (ret)
+               goto end;
 
        if (event->ctx) {
                ret = lttng_metadata_printf(session,
@@ -1132,8 +1134,8 @@ int _ltt_session_metadata_statedump(struct ltt_session *session)
                lttng_alignof(uint16_t) * CHAR_BIT,
                lttng_alignof(uint32_t) * CHAR_BIT,
                lttng_alignof(uint64_t) * CHAR_BIT,
-               CTF_VERSION_MAJOR,
-               CTF_VERSION_MINOR,
+               CTF_SPEC_MAJOR,
+               CTF_SPEC_MINOR,
                uuid_s,
 #if (BYTE_ORDER == BIG_ENDIAN)
                "be"
@@ -1151,11 +1153,17 @@ int _ltt_session_metadata_statedump(struct ltt_session *session)
                "env {\n"
                "       vpid = %d;\n"
                "       procname = \"%s\";\n"
-               "       domain = %s;\n"
+               "       domain = \"ust\";\n"
+               "       tracer_name = \"lttng-ust\";\n"
+               "       tracer_major = %u;\n"
+               "       tracer_minor = %u;\n"
+               "       tracer_patchlevel = %u;\n"
                "};\n\n",
                (int) getpid(),
                procname,
-               "ust"
+               LTTNG_UST_MAJOR_VERSION,
+               LTTNG_UST_MINOR_VERSION,
+               LTTNG_UST_PATCHLEVEL_VERSION
                );
        if (ret)
                goto end;
@@ -1447,3 +1455,16 @@ int ltt_wildcard_disable(struct session_wildcard *wildcard)
        wildcard->enabled = 0;
        return 0;
 }
+
+/*
+ * Take the TLS "fault" in libuuid if dlopen'd, which can take the
+ * dynamic linker mutex, outside of the UST lock, since the UST lock is
+ * taken in constructors, which are called with dynamic linker mutex
+ * held.
+ */
+void lttng_fixup_event_tls(void)
+{
+       unsigned char uuid[37];
+
+       (void) uuid_generate(uuid);
+}
This page took 0.024605 seconds and 4 git commands to generate.