From 141feb8ca12d48ef5adfcda81faa7e0d2fc32c7a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sun, 30 Aug 2015 17:37:41 -0400 Subject: [PATCH] Prevent the addition of UST events to agent channels MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- include/lttng/lttng-error.h | 1 + src/bin/lttng-sessiond/cmd.c | 10 ++++++++++ src/common/error.c | 1 + 3 files changed, 12 insertions(+) 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" -- 2.34.1