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, 8 Sep 2015 12:55:20 +0000 (08:55 -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 38ffbb16340d51f290f5a4a983c0c73a3766aedc..63d91f53d197ecc4b54d19a00dafee24668011f5 100644 (file)
@@ -1673,6 +1673,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.028131 seconds and 4 git commands to generate.