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.7.0-rc2~121 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=9ab6d7ea85654f60d8425deaed2be2da162a9093;p=lttng-tools.git 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 38ffbb163..63d91f53d 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -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 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"