diff options
author | Leo Yan <leo.yan@arm.com> | 2024-10-12 21:47:24 +0100 |
---|---|---|
committer | Namhyung Kim <namhyung@kernel.org> | 2024-10-17 09:55:58 -0700 |
commit | 6768faf9b70eec01c3c6d685b4f39049c561dbda (patch) | |
tree | 1660e6345efcc98c3c3b2a56f45ccc4a6353a170 /tools | |
parent | d08e3f14e87259b9d63bf7eea7072d1bd61392ef (diff) |
perf probe: Check group string length
In the kernel, the probe group string length is limited up to
MAX_EVENT_NAME_LEN (including the NULL terminator).
Check for this limitation and report an error if it is exceeded.
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Leo Yan <leo.yan@arm.com>
Link: https://lore.kernel.org/r/20241012204725.928794-3-leo.yan@arm.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/probe-event.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 83b5744da50c..2903341a4309 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -2868,6 +2868,12 @@ static int probe_trace_event__set_name(struct probe_trace_event *tev, else group = PERFPROBE_GROUP; + if (strlen(group) >= MAX_EVENT_NAME_LEN) { + pr_err("Probe group string='%s' is too long (>= %d bytes)\n", + group, MAX_EVENT_NAME_LEN); + return -ENOMEM; + } + /* Get an unused new event name */ ret = get_new_event_name(buf, sizeof(buf), event, namelist, tev->point.retprobe, allow_suffix); |