Prevent the addition of UST events to agent channels
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 30 Aug 2015 21:37:41 +0000 (17:37 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 1 Sep 2015 16:03:08 +0000 (12:03 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/lttng/lttng-error.h
src/bin/lttng-sessiond/cmd.c
src/common/error.c

index a7746fadff8cc8784fc40b1a813afbcc503157ff..1340dc29be00d83f114076c28de785e8a2d2a6ce 100644 (file)
@@ -136,6 +136,7 @@ enum lttng_error_code {
        LTTNG_ERR_INVALID_CHANNEL_NAME   = 113, /* Invalid channel name */
        LTTNG_ERR_PID_TRACKED            = 114, /* PID already tracked */
        LTTNG_ERR_PID_NOT_TRACKED        = 115, /* PID not tracked */
+       LTTNG_ERR_INVALID_CHANNEL_DOMAIN = 116, /* Invalid channel domain */
 
        /* MUST be last element */
        LTTNG_ERR_NR,                           /* Last element */
index e1fbf769cbfb2833ecd98dc6b2f168e98f71dd4b..f8fa4dedddda209c3280b05e71f105d45a79a66d 100644 (file)
@@ -1687,6 +1687,16 @@ static int _cmd_enable_event(struct ltt_session *session,
                        assert(uchan);
                }
 
+               if (uchan->domain != LTTNG_DOMAIN_UST && !internal_event) {
+                       /*
+                        * Don't allow users to add UST events to channels which
+                        * are assigned to a userspace subdomain (JUL, Log4J,
+                        * Python, etc.).
+                        */
+                       ret = LTTNG_ERR_INVALID_CHANNEL_DOMAIN;
+                       goto error;
+               }
+
                if (!internal_event) {
                        /*
                         * Ensure the event name is not reserved for internal
index 93506dafc1007a59dc99bf334c9e08a0104543a6..d046dcba97004bb068942814c4d85a89ad5cd904 100644 (file)
@@ -169,6 +169,7 @@ static const char *error_string_array[] = {
        [ ERROR_INDEX(LTTNG_ERR_INVALID_CHANNEL_NAME) ] = "Invalid channel name",
        [ ERROR_INDEX(LTTNG_ERR_PID_TRACKED) ] = "PID already tracked",
        [ ERROR_INDEX(LTTNG_ERR_PID_NOT_TRACKED) ] = "PID not tracked",
+       [ ERROR_INDEX(LTTNG_ERR_INVALID_CHANNEL_DOMAIN) ] = "Invalid channel domain",
 
        /* Last element */
        [ ERROR_INDEX(LTTNG_ERR_NR) ] = "Unknown error code"
This page took 0.028796 seconds and 4 git commands to generate.