]> git.lttng.org Git - lttng-tools.git/commitdiff
Fix: sessiond: assertion on inconsistent filter bytecode and expression
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 1 Oct 2024 19:47:57 +0000 (15:47 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 22 Nov 2024 20:33:39 +0000 (20:33 +0000)
The session daemon correctly expects that a recording event-rule that
specifies a filter must have both a bytecode and an expression (or
neither of them).

However, it shouldn't assert as those elements are user-specified. The
handling is changed to return an "invalid parameter" error to the
client.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I3df6ce79bc6ce1fa9dadb184a7fd2b528dc2a597

src/bin/lttng-sessiond/cmd.cpp

index f1b29da9ccdd9c9f937209df70061bbcb76607e0..76abcd65d02704891f57f2794d3f317df4f17f59 100644 (file)
@@ -2093,9 +2093,6 @@ static int _cmd_enable_event(ltt_session::locked_ref& locked_session,
        LTTNG_ASSERT(event);
        LTTNG_ASSERT(channel_name);
 
-       /* If we have a filter, we must have its filter expression */
-       LTTNG_ASSERT(!(!!filter_expression ^ !!filter));
-
        /* Normalize event name as a globbing pattern */
        strutils_normalize_star_glob_pattern(event->name);
 
@@ -2112,6 +2109,13 @@ static int _cmd_enable_event(ltt_session::locked_ref& locked_session,
 
        const lttng::urcu::read_lock_guard read_lock;
 
+       /* If we have a filter, we must have its filter expression. */
+       if (!!filter_expression ^ !!filter) {
+               DBG("Refusing to enable recording event rule as it has an inconsistent filter expression and bytecode specification");
+               ret = LTTNG_ERR_INVALID;
+               goto error;
+       }
+
        switch (domain->type) {
        case LTTNG_DOMAIN_KERNEL:
        {
This page took 0.030432 seconds and 4 git commands to generate.