Skip to content

Commit 6768faf

Browse files
Leo-Yannamhyung
authored andcommitted
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>
1 parent d08e3f1 commit 6768faf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tools/perf/util/probe-event.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2868,6 +2868,12 @@ static int probe_trace_event__set_name(struct probe_trace_event *tev,
28682868
else
28692869
group = PERFPROBE_GROUP;
28702870

2871+
if (strlen(group) >= MAX_EVENT_NAME_LEN) {
2872+
pr_err("Probe group string='%s' is too long (>= %d bytes)\n",
2873+
group, MAX_EVENT_NAME_LEN);
2874+
return -ENOMEM;
2875+
}
2876+
28712877
/* Get an unused new event name */
28722878
ret = get_new_event_name(buf, sizeof(buf), event, namelist,
28732879
tev->point.retprobe, allow_suffix);

0 commit comments

Comments
 (0)