From: Jérémie Galarneau Date: Sun, 30 Aug 2015 21:37:41 +0000 (-0400) Subject: Prevent the addition of UST events to agent channels X-Git-Tag: v2.8.0-rc1~450 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=141feb8ca12d48ef5adfcda81faa7e0d2fc32c7a Prevent the addition of UST events to agent channels Signed-off-by: Jérémie Galarneau --- diff --git a/include/lttng/lttng-error.h b/include/lttng/lttng-error.h index a7746fadf..1340dc29b 100644 --- a/include/lttng/lttng-error.h +++ b/include/lttng/lttng-error.h @@ -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 */ diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index e1fbf769c..f8fa4dedd 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -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 diff --git a/src/common/error.c b/src/common/error.c index 93506dafc..d046dcba9 100644 --- a/src/common/error.c +++ b/src/common/error.c @@ -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"